Merge remote-tracking branch 'upstream/master' into a5200

This commit is contained in:
Christian Groessler 2014-04-25 02:07:44 +02:00
commit ec417c0dc5
67 changed files with 1685 additions and 809 deletions

1
.gitignore vendored
View file

@ -1,6 +1,7 @@
/bin/
/emd/
/html/
/info/
/joy/
/lib/
/libwrk/

View file

@ -1,5 +1,7 @@
[documentation](http://cc65.github.io/cc65/doc)
[wiki](https://github.com/cc65/wiki/wiki)
[![build status](https://travis-ci.org/cc65/cc65.png)](https://travis-ci.org/cc65/cc65/builds)
cc65 is a complete cross development package for 65(C)02 systems, including

View file

@ -4,7 +4,7 @@
; Taken from a kernal disassembly done by myself in 2000/2001.
;
; 2001-09-13, Ullrich von Bassewitz
; 2013-08-26, Greg King
; 2014-04-02, Greg King
;-----------------------------------------------------------------------------
@ -14,6 +14,8 @@ ExecReg := $00 ; Controls execution memory bank
IndReg := $01 ; Controls indirect indexed load-store bank
TXTPTR := $85 ; Far pointer into BASIC source code
FNAM := $90 ; Far pointer to LOAD/SAVE file-name
FNAM_LEN := $9D ; Holds length of file-name
; ---------------------------------------------------------------------------
; Screen size

View file

@ -4,7 +4,7 @@
; Taken from a kernal disassembly done by myself in 1987.
;
; 1998-09-28, Ullrich von Bassewitz
; 2013-08-26, Greg King
; 2014-04-02, Greg King
; ---------------------------------------------------------------------------
@ -14,6 +14,8 @@ ExecReg := $00 ; Controls execution memory bank
IndReg := $01 ; Controls indirect indexed load-store bank
TXTPTR := $85 ; Far pointer into BASIC source code
FNAM := $90 ; Far pointer to LOAD/SAVE file-name
FNAM_LEN := $9D ; Holds length of file-name
; ---------------------------------------------------------------------------
; Screen size

View file

@ -6,11 +6,14 @@ endif
.SUFFIXES:
all mostlyclean install:
htmldir = $(prefix)/share/doc/cc65$(DESTPACKAGE_SUFFIX)/html
infodir = $(prefix)/share/info
all mostlyclean:
ifdef CMD_EXE
clean zip doc:
clean install zip doc:
else # CMD_EXE
@ -21,9 +24,22 @@ TOC_LEVEL = 0
TOC_LEVEL = 2
INSTALL = install
clean:
$(RM) -r ../html ../info
install:
$(if $(prefix),,$(error variable `prefix' must be set))
ifeq ($(wildcard ../html),../html)
$(INSTALL) -d $(DESTDIR)$(htmldir)
$(INSTALL) -m644 ../html/*.* $(DESTDIR)$(htmldir)
endif
ifeq ($(wildcard ../info),../info)
$(INSTALL) -d $(DESTDIR)$(infodir)
$(INSTALL) -m644 ../info/*.* $(DESTDIR)$(infodir)
endif
zip:
@cd .. && zip cc65 html/*.*

View file

@ -3,8 +3,8 @@
<article>
<title>Apple&nbsp;&rsqb;&lsqb; specific information for cc65
<author>Oliver Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de">
<date>2009-10-07
<author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt">
<date>2014-04-10
<abstract>
An overview over the Apple&nbsp;&rsqb;&lsqb; runtime system as it is
@ -24,7 +24,7 @@ Apple&nbsp;&rsqb;&lsqb; specific header files, available drivers, and any
pitfalls specific to that platform.
Please note that Apple&nbsp;&rsqb;&lsqb; specific functions are just mentioned
here, they are described in detail in the separate <htmlurl url="funcref.html"
here, they are described in detail in the separate <url url="funcref.html"
name="function reference">. Even functions marked as "platform dependent" may
be available on more than one platform. Please see the function reference for
more information.
@ -45,7 +45,7 @@ containing DOS 3.3 as well as ProDOS 8.
For ProDOS 8 system programs the load address is fixed to &dollar;2000 so there
is no need for a header. Thus the linker configuration
<htmlurl url="apple2.html#ss4.3" name="apple2-system.cfg"> for those programs
<ref id="apple-sys-cfg" name="apple2-system.cfg"> for those programs
omits the DOS 3.3 header. The right AppleCommander option to put system files
without a header on a ProDOS 8 disk image is <tt/-p/.
@ -81,11 +81,11 @@ cc65 runtime system takes care of actually moving the code into the Language
Card.
The amount of memory available in the Language Card for generated code depends
on the chosen <htmlurl url="apple2.html#s4" name="linker configuration">.
on the chosen <ref id="link-configs" name="linker configuration">.
<sect>Linker configurations<p>
<sect>Linker configurations<label id="link-configs"><p>
The ld65 linker comes with a default config file for the Apple&nbsp;&rsqb;&lsqb;,
which is used via <tt/-t apple2/.
@ -138,7 +138,7 @@ vanilla DOS 3.3 doesn't make use of the Language Card at all.
</descrip><p>
<sect1><tt/apple2-system.cfg/<p>
<sect1><tt/apple2-system.cfg/<label id="apple-sys-cfg"><p>
Configuration for a system program running on ProDOS 8.
@ -159,7 +159,7 @@ Configuration for a system program running on ProDOS 8.
</descrip><p>
<sect1><tt/apple2-loader.cfg/<p>
<sect1><tt/apple2-loader.cfg/<label id="apple-load-cfg"><p>
Configuration optimized for a binary program running on ProDOS 8 without
BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an
@ -231,7 +231,7 @@ range.
The easiest (and for really large programs in fact the only) way to have a cc65
program use the memory from &dollar;800 to &dollar;2000 is to link it as binary
(as opposed to system) program using the linker configuration
<htmlurl url="apple2.html#ss4.4" name="apple2-loader.cfg"> with start address
<ref id="apple-load-cfg" name="apple2-loader.cfg"> with start address
&dollar;803 and load it with the targetutil LOADER.SYSTEM. The program then works
like a system program (i.e. quits to the ProDOS dispatcher).
@ -243,7 +243,7 @@ example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/.
<sect1>Heap<p>
If the cc65 program can be successfully linked as system program using the linker
configuration <htmlurl url="apple2.html#ss4.3" name="apple2-system.cfg"> but
configuration <ref id="apple-sys-cfg" name="apple2-system.cfg">, but
uses the heap either explicitly or implicitly (i.e. by loading a driver) then
the memory from &dollar;800 to &dollar;2000 can be added to the heap by calling
<tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/.
@ -268,7 +268,7 @@ default I/O buffer allocation basically yields the same placement of I/O buffers
in memory the primary benefit of <tt/apple2-iobuf-0800.o/ is a reduction in code
size - and thus program file size - of more than 1400 bytes.
Using <tt/apple2-iobuf-0800.o/ is as simple as placing it on the linker command
Using <tt/apple2-iobuf-0800.o/ is as simple as placing it on the linker command
line like this:
<tscreen><verb>
@ -286,7 +286,7 @@ Programs containing Apple&nbsp;&rsqb;&lsqb; specific code may use the
<sect1>Apple&nbsp;&rsqb;&lsqb; specific functions<p>
The functions listed below are special for the Apple&nbsp;&rsqb;&lsqb;. See
the <htmlurl url="funcref.html" name="function reference"> for declaration and
the <url url="funcref.html" name="function reference"> for declaration and
usage.
<itemize>
@ -347,7 +347,7 @@ The names in the parentheses denote the symbols to be used for static linking of
<tag><tt/a2.auxmem.emd (a2_auxmem_emd)/</tag>
Gives access to 47.5 KB RAM (190 pages of 256 bytes each) on an Extended
80-Column Text Card.
Note that this driver doesn't check for the actual existence of the memory
and that it doesn't check for ProDOS 8 RAM disk content!
@ -373,7 +373,7 @@ The names in the parentheses denote the symbols to be used for static linking of
Driver for the AppleMouse&nbsp;II Card. Searches all Apple&nbsp;II slots
for an AppleMouse&nbsp;II Card compatible firmware. The default bounding
box is &lsqb;0..279,0..191&rsqb;.
Programs using this driver will have to be linked with <tt/--start-addr $4000/
to reserve the first hires page if they are intended to run on an
Apple&nbsp;&rsqb;&lsqb; (in contrast to an Apple&nbsp;//e) because the
@ -428,7 +428,7 @@ BASIC.SYSTEM) there are some limitations for DOS 3.3:
'FAILED TO ALLOC INTERRUPT' on program startup. This implicitly means that
<tt/a2.stdmou.mou/ and <tt/a2.ssc.ser/ are not functional as they depend on
interrupts.
</descrip><p>
@ -477,7 +477,7 @@ The runtime for the Apple&nbsp;&rsqb;&lsqb; uses routines marked as
<tt/.INTERRUPTOR/ for ProDOS 8 interrupt handlers. Such routines must be
written as simple machine language subroutines and will be called
automatically by the interrupt handler code when they are linked into a
program. See the discussion of the <tt/.CONDES/ feature in the <htmlurl
program. See the discussion of the <tt/.CONDES/ feature in the <url
url="ca65.html" name="assembler manual">.
@ -486,7 +486,7 @@ url="ca65.html" name="assembler manual">.
<descrip>
<tag/Drive ID/
The function <htmlurl url="dio.html#s1" name="dio_open()"> has the single
The function <url url="dio.html#s1" name="dio_open()"> has the single
parameter <tt/device/ to identify the device to be opened. Therefore an
Apple&nbsp;II slot and drive pair is mapped to that <tt/device/ according
to the formula
@ -498,7 +498,7 @@ url="ca65.html" name="assembler manual">.
so that for example slot 6 drive 2 is mapped to <tt/device/ 14.
<tag/Sector count/
The function <htmlurl url="dio.html#s3" name="dio_query_sectcount()"> returns
The function <url url="dio.html#s3" name="dio_query_sectcount()"> returns
the correct sector count for all ProDOS 8 disks. However for any non-ProDOS 8
disk it simply always returns 280 (which is only correct for a 140 KB disk).
This condition is indicated by the <tt/_oserror/ value 82.

View file

@ -3,8 +3,8 @@
<article>
<title>Enhanced&nbsp;Apple&nbsp;//e specific information for cc65
<author>Oliver Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de">
<date>2009-10-07
<author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt">
<date>2014-04-10
<abstract>
An overview over the enhanced&nbsp;Apple&nbsp;//e runtime system as it is
@ -24,7 +24,7 @@ enhanced&nbsp;Apple&nbsp;//e specific header files, available drivers, and any
pitfalls specific to that platform.
Please note that enhanced&nbsp;Apple&nbsp;//e specific functions are just mentioned
here, they are described in detail in the separate <htmlurl url="funcref.html"
here, they are described in detail in the separate <url url="funcref.html"
name="function reference">. Even functions marked as "platform dependent" may
be available on more than one platform. Please see the function reference for
more information.
@ -45,7 +45,7 @@ containing DOS 3.3 as well as ProDOS 8.
For ProDOS 8 system programs the load address is fixed to &dollar;2000 so there
is no need for a header. Thus the linker configuration
<htmlurl url="apple2enh.html#ss4.3" name="apple2enh-system.cfg"> for those programs
<ref id="apple-sys-cfg" name="apple2enh-system.cfg"> for those programs
omits the DOS 3.3 header. The right AppleCommander option to put system files
without a header on a ProDOS 8 disk image is <tt/-p/.
@ -81,11 +81,11 @@ cc65 runtime system takes care of actually moving the code into the Language
Card.
The amount of memory available in the Language Card for generated code depends
on the chosen <htmlurl url="apple2enh.html#s4" name="linker configuration">.
on the chosen <ref id="link-configs" name="linker configuration">.
<sect>Linker configurations<p>
<sect>Linker configurations<label id="link-configs"><p>
The ld65 linker comes with a default config file for the enhanced&nbsp;Apple&nbsp;//e,
which is used via <tt/-t apple2enh/.
@ -138,7 +138,7 @@ vanilla DOS 3.3 doesn't make use of the Language Card at all.
</descrip><p>
<sect1><tt/apple2enh-system.cfg/<p>
<sect1><tt/apple2enh-system.cfg/<label id="apple-sys-cfg"><p>
Configuration for a system program running on ProDOS 8.
@ -159,7 +159,7 @@ Configuration for a system program running on ProDOS 8.
</descrip><p>
<sect1><tt/apple2enh-loader.cfg/<p>
<sect1><tt/apple2enh-loader.cfg/<label id="apple-load-cfg"><p>
Configuration optimized for a binary program running on ProDOS 8 without
BASIC.SYSTEM. Intended to be used with <bf/LOADER.SYSTEM - an
@ -231,7 +231,7 @@ range.
The easiest (and for really large programs in fact the only) way to have a cc65
program use the memory from &dollar;800 to &dollar;2000 is to link it as binary
(as opposed to system) program using the linker configuration
<htmlurl url="apple2enh.html#ss4.4" name="apple2enh-loader.cfg"> with start address
<ref id="apple-load-cfg" name="apple2enh-loader.cfg"> with start address
&dollar;803 and load it with the targetutil LOADER.SYSTEM. The program then works
like a system program (i.e. quits to the ProDOS dispatcher).
@ -243,7 +243,7 @@ example the program <tt/MYPROG/ is loaded by <tt/MYPROG.SYSTEM/.
<sect1>Heap<p>
If the cc65 program can be successfully linked as system program using the linker
configuration <htmlurl url="apple2enh.html#ss4.3" name="apple2enh-system.cfg"> but
configuration <ref id="apple-sys-cfg" name="apple2enh-system.cfg">, but
uses the heap either explicitly or implicitly (i.e. by loading a driver) then
the memory from &dollar;800 to &dollar;2000 can be added to the heap by calling
<tt/_heapadd ((void *) 0x0800, 0x1800);/ at the beginning of <tt/main()/.
@ -286,7 +286,7 @@ Programs containing enhanced&nbsp;Apple&nbsp;//e specific code may use the
<sect1>Enhanced&nbsp;Apple&nbsp;//e specific functions<p>
The functions listed below are special for the enhanced&nbsp;Apple&nbsp;//e. See
the <htmlurl url="funcref.html" name="function reference"> for declaration and
the <url url="funcref.html" name="function reference"> for declaration and
usage.
<itemize>
@ -483,7 +483,7 @@ The runtime for the enhanced&nbsp;Apple&nbsp;//e uses routines marked as
<tt/.INTERRUPTOR/ for ProDOS 8 interrupt handlers. Such routines must be
written as simple machine language subroutines and will be called
automatically by the interrupt handler code when they are linked into a
program. See the discussion of the <tt/.CONDES/ feature in the <htmlurl
program. See the discussion of the <tt/.CONDES/ feature in the <url
url="ca65.html" name="assembler manual">.
@ -492,7 +492,7 @@ url="ca65.html" name="assembler manual">.
<descrip>
<tag/Drive ID/
The function <htmlurl url="dio.html#s1" name="dio_open()"> has the single
The function <url url="dio.html#s1" name="dio_open()"> has the single
parameter <tt/device/ to identify the device to be opened. Therefore an
Apple&nbsp;II slot and drive pair is mapped to that <tt/drive_id/ according
to the formula
@ -504,7 +504,7 @@ url="ca65.html" name="assembler manual">.
so that for example slot 6 drive 2 is mapped to <tt/device/ 14.
<tag/Sector count/
The function <htmlurl url="dio.html#s3" name="dio_query_sectcount()"> returns
The function <url url="dio.html#s3" name="dio_query_sectcount()"> returns
the correct sector count for all ProDOS 8 disks. However for any non-ProDOS 8
disk it simply always returns 280 (which is only correct for a 140 KB disk).
This condition is indicated by the <tt/_oserror/ value 82.

View file

@ -3,7 +3,7 @@
<article>
<title>ar65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>19.07.2000
<abstract>

View file

@ -3,11 +3,10 @@
<article>
<title>Atari specific information for cc65
<author>Shawn Jefferson, <htmlurl
url="mailto:shawnjefferson@24fightingchickens.com"
name="shawnjefferson@24fightingchickens.com"> and
Christian Groessler, <htmlurl url="mailto:chris@groessler.org" name="chris@groessler.org">
<date>03-Jan-2006
<author>
<url url="mailto:shawnjefferson@24fightingchickens.com" name="Shawn Jefferson"> and<newline>
<url url="mailto:chris@groessler.org" name="Christian Groessler">
<date>2014-04-10
<abstract>
An overview over the Atari runtime system as it is implemented for the cc65 C
@ -31,13 +30,13 @@ The <tt/atari/ target supports all Atari 8-bit computers, the <tt/atarixl/ only
supports XL type or newer machines (excluding the 600XL).
The <tt/atarixl/ runtime makes the whole 64K of memory available, with the
exception of the I/O area at &dollar;D000 - &dollar;D7FFF. Since the
exception of the I/O area at &dollar;D000 - &dollar;D7FF. Since the
<tt/atarixl/ runtime has some <ref name="limitations" id="limitations">, it is
recommended to use the <tt/atari/ target unless lack of memory dictates the
use of the <tt/atarixl/ target.
Please note that Atari specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -64,7 +63,7 @@ detailed information about the load chunks see the chapter
sufficient to know that the first load chunk(s) do preparation work and the
main part of the program is in the last load chunk.
The values determining the size of the main part of the program (the only load
The values determining the size of the main part of the program (the second load
chunk for <tt/atari/, the third load chunk for <tt/atarixl/) are calculated in
the crt0.s file from the __STARTUP_LOAD__ and __BSS_LOAD__ values.
Be aware of that if you create a custom linker config file and start moving segments around (see section
@ -131,11 +130,12 @@ areas available, &lsqb;&dollar;D800-&dollar;DFFF&rsqb; and &lsqb;&dollar;E400-&d
</enum>
With the default load address of &dollar;2400 this gives a usable memory range of
&lsqb;&dollar;2400-&dollar;CFFF&rsqb;. Note that the default load address for <tt/atarixl/ is
different (and lower) that the default load address for <tt/atari/. This is no problem since
on the <tt/atarixl/ target the first load chunk makes sure that the loaded prgram won't overwrite
memory below MEMLO. See <ref name="atarixl load chunks" id="xlchunks">.
&lsqb;&dollar;2400-&dollar;CFFF&rsqb;.
Please note that the first load chunk (which checks the system
compatibilty and available memory) will always be loaded at
&dollar;2E00, regardless of the specified start address. This address
can only be changed by a custom linker config file.
Special locations:
@ -265,7 +265,7 @@ header file.
<sect1>Atari specific functions<p>
The functions and global variable listed below are special for the Atari.
See the <htmlurl url="funcref.html" name="function reference"> for declaration and usage.
See the <url url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
<item>get_ostype
@ -412,6 +412,8 @@ The values of "1" are needed because the graphics command crashes if
it doesn't have at least one byte available. This seems to be a bug of
the Atari ROM code.
Default drivers: <tt/atr8.tgi (atr8_tgi)/ and <tt/atrx8.tgi (atrx8_tgi)/.
<sect1>Extended memory drivers<p>
Currently there is only one extended memory driver. It manages the second 64K of a 130XE.
@ -436,6 +438,7 @@ Currently there are two joystick drivers available:
<caption>
</table>
Default drivers: <tt/atrstd.joy (atrstd_joy)/ and <tt/atrxstd.joy (atrxstd_joy)/.
<sect1>Mouse drivers<p>
@ -455,6 +458,50 @@ Currently there are five mouse drivers available:
All mouse devices connect to joystick port #0.
Default drivers: <tt/atrst.mou (atrst_mou)/ and <tt/atrxst.mou (atrxst_mou)/.
<sect2>Mouse callbacks<p>
There are two mouse callbacks available.
<p>
The "text mode" callbacks (<tt/mouse_txt_callbacks/) display the mouse cursor as a "diamond" character
on the standard "GRAPHICS 0" text mode screen. The mouse cursor character can be changed by an
assembly file defining the character by exporting the zeropage symbol <tt/mouse_txt_char/.
The default file looks like this:
<tscreen><verb>
.export mouse_txt_char : zp = 96 ; 'diamond' screen code
</verb></tscreen>
<p>
The "P/M" callbacks (<tt/mouse_pm_callbacks/) use Player-Missile graphics for the mouse cursor.
The cursor shape can be changed, too, by an assembly file. Here's the default shape definition:
<tscreen><verb>
.export mouse_pm_bits
.export mouse_pm_height : zeropage
.export mouse_pm_hotspot_x : zeropage
.export mouse_pm_hotspot_y : zeropage
.rodata
mouse_pm_bits:
.byte %11110000
.byte %11000000
.byte %10100000
.byte %10010000
.byte %10001000
.byte %00000100
.byte %00000010
mouse_pm_height = * - mouse_pm_bits
; hot spot is upper left corner
mouse_pm_hotspot_x = 0
mouse_pm_hotspot_y = 0
</verb></tscreen>
<p>
<tt/mouse_pm_bits/ defines the shape of the cursor, <tt/mouse_pm_height/ defines the number of
bytes in <tt/mouse_pm_bits/. <tt/mouse_pm_hotspot_x/ and <tt/mouse_pm_hotspot_y/ define the
position in the shape where "the mouse points to". When using this callback page #6 (&dollar;600
- &dollar;6FF) is used for the P/M graphics data and no P/M graphics can otherwise be used
by the program. The height of the shape (<tt/mouse_pm_height/)
must not exceed 32 lines since the callback routines cannot handle more than 32 lines.
<p>
The default callbacks definition (<tt/mouse_def_callbacks/) is an alias for the "P/M" callbacks.
<sect1>RS232 device drivers<p>
@ -646,14 +693,14 @@ Function keys are mapped to Atari + number key.
<sect1>Passing arguments to the program<p>
Command line arguments can be passed to <tt/main()/ when DOS supports it.
Command line arguments can be passed to <tt/main()/ when the used DOS supports it.
<enum>
<item>Arguments are separated by spaces.
<item>Leading and trailing spaces around an argument are ignored.
<item>The first argument passed to <tt/main/ is the program name.
<item>A maximum number of 16 arguments (including the program name) are
supported.
supported.
</enum>
@ -663,8 +710,10 @@ The runtime for the Atari uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the VBI handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.
Please note that on the Atari targets the <tt/.INTERRUPTOR/s are being
run in NMI context. The other targets run them in IRQ context.
<sect1>Reserving a memory area inside a program<label id="memhole"><p>
@ -696,7 +745,7 @@ segments should go above &dollar;7FFF.
<p>
The main problem is that the EXE header generated by the cc65 runtime
lib is wrong. It defines a single load chunk with the sizes/addresses
of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in
of the STARTUP, LOWCODE, INIT, CODE, RODATA, and DATA segments, in
fact, the whole user program (we're disregarding the "system check"
load chunk here).
<p>

View file

@ -2,11 +2,12 @@
<article>
<title>Oric Atmos specific information for cc65
<author>Ullrich von Bassewitz <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org"><newline>
Stefan A. Haubenthal <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org"><newline>
<title>Oric Atmos-specific information for cc65
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2013-01-08
<date>2014-03-27
<abstract>
An overview over the Atmos runtime system as it is implemented for the cc65 C
@ -21,11 +22,11 @@ compiler.
<sect>Overview<p>
This file contains an overview of the Atmos runtime system as it comes with the
cc65 C compiler. It describes the memory layout, Atmos specific header files,
cc65 C compiler. It describes the memory layout, Atmos-specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that Atmos specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that Atmos-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -58,19 +59,25 @@ Special locations:
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing Atmos specific code may use the <tt/atmos.h/ header file.
Programs containing Atmos-specific code may use the <tt/atmos.h/ header file.
<sect1>Atmos specific functions<p>
<sect1>Atmos-specific functions<p>
The functions listed below are special for the Atmos. See the <htmlurl
The functions listed below are special for the Atmos. See the <url
url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
<item>atmos_load
<item>atmos_save
<item>atmos_explode
<item>atmos_ping
<item>atmos_shoot
<item>atmos_tick
<item>atmos_tock
<item>atmos_zap
</itemize>
@ -78,7 +85,7 @@ url="funcref.html" name="function reference"> for declaration and usage.
The following pseudo variables declared in the <tt/atmos.h/ header file do allow
access to hardware located in the address space. Some variables are
structures, accessing the struct fields will access the chip registers.
structures; accessing the struct fields will access the chip registers.
<descrip>
@ -110,6 +117,8 @@ The names in the parentheses denote the symbols to be used for static linking of
<sect1>Graphics drivers<p>
The default drivers, <tt/tgi_stddrv (tgi_static_stddrv)/, point to <tt/atmos-240-200-2.tgi (atmos_240_200_2_tgi)/.
<descrip>
<tag><tt/atmos-228-200-3.tgi (atmos_228_200_3_tgi)/</tag>
@ -154,8 +163,8 @@ No mouse drivers are currently available for the Atmos.
<tag><tt/atmos-acia.ser (atmos_acia_ser)/</tag>
Driver for the Telestrat integrated serial controller and the Atmos with a
serial add-on.
Note that because of the peculiarities of the 6551 chip together with the
use of the NMI, transmits are not interrupt driven, and the transceiver
Note that, because of the peculiarities of the 6551 chip, together with the
use of the NMI, transmits are not interrupt driven; and, the transceiver
blocks if the receiver asserts flow control because of a full buffer.
</descrip><p>
@ -167,12 +176,12 @@ No mouse drivers are currently available for the Atmos.
<sect1>Disk I/O<p>
The existing library for the Atmos doesn't implement C file
I/O. There is one hack for the <tt/write()/ routine in
place, which will make functions work that write to <tt/stdout/
(like <tt/printf()/). However, this function has some shortcomings which
won't be fixed, because it's going to be replaced anyway.
I/O. There are hacks for the <tt/read()/ and <tt/write()/ routines in
place, which will make functions work that read from and write to <tt/stdout/
(like <tt/printf()/). However, those functions have some shortcomings which
won't be fixed, because they're going to be replaced anyway.
To be more concrete, this limitation means that you cannot use any of the
To be more concrete, the limitation means that you cannot use any of the
following functions (and a few others):
<itemize>
@ -190,14 +199,16 @@ following functions (and a few others):
<sect>Other hints<p>
<sect1>Function keys<p>
These are defined to be FUNCT + number key.
<sect1>Passing arguments to the program<p>
Command line arguments can be passed to <tt/main()/. Since this is not
supported by BASIC, the following syntax was chosen:
Command-line arguments can be passed to <tt/main()/. Since that is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
CALL#500:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
@ -208,7 +219,7 @@ supported by BASIC, the following syntax was chosen:
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main/ is the program name.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
@ -220,7 +231,7 @@ The runtime for the Atmos uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.
@ -246,6 +257,3 @@ freely, subject to the following restrictions:
</enum>
</article>

View file

@ -2,9 +2,9 @@
<article>
<title>Commodore 128 specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2003-12-14
<title>Commodore 128-specific information for cc65
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-12
<abstract>
An overview over the C128 runtime system as it is implemented for the cc65 C
@ -19,11 +19,11 @@ compiler.
<sect>Overview<p>
This file contains an overview of the C128 runtime system as it comes with the
cc65 C compiler. It describes the memory layout, C128 specific header files,
cc65 C compiler. It describes the memory layout, C128-specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that C128 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that C128-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -59,27 +59,27 @@ Special locations:
The text screen is located at &dollar;400 (as in the standard setup).
<tag/Stack/
The C runtime stack is located at &dollar;BFFF and growing downwards.
The C runtime stack is located at &dollar;BFFF, and growing downwards.
<tag/Heap/
The C heap is located at the end of the program and grows towards the C
The C heap is located at the end of the program, and grows towards the C
runtime stack.
</descrip><p>
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing C128 specific code may use the <tt/c128.h/ or <tt/cbm.h/
Programs containing C128-specific code may use the <tt/c128.h/ or <tt/cbm.h/
header files. Using the later may be an option when writing code for more than
one CBM platform, since it includes <tt/c128.h/ and declares several functions
common to all CBM platforms.
<sect1>C128 specific functions<p>
<sect1>C128-specific functions<p>
The functions listed below are special for the C128. See the <htmlurl
The functions listed below are special for the C128. See the <url
url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
@ -90,10 +90,10 @@ url="funcref.html" name="function reference"> for declaration and usage.
</itemize>
<sect1>CBM specific functions<p>
<sect1>CBM-specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
<itemize>
@ -164,26 +164,28 @@ The names in the parentheses denote the symbols to be used for static linking of
<sect1>Graphics drivers<p>
The default drivers, <tt/tgi_stddrv (tgi_static_stddrv)/, point to <tt/c128-vdc.tgi (c128_vdc_tgi)/.
Note: The graphics drivers for the VDC are incompatible with the extended
memory drivers using the VDC memory!
<descrip>
<tag><tt/c128-vdc.tgi (c128_vdc_tgi)/</tag>
This driver was written by Maciej Witkowiak. It uses the 80 column display
This driver was written by Maciej Witkowiak. It uses the 80-column display,
and features a resolution of 640*200 with two colors and an adjustable
palette (that means that the two colors can be chosen out of the 16 VDC
colors).
<tag><tt/c128-vdc2.tgi (c128_vdc2_tgi)/</tag>
This driver was written by Maciej Witkowiak. This driver uses the 80 column
display and features a resolution of 640*480 with two colors and an
This driver was written by Maciej Witkowiak. This driver uses the 80-column
display, and features a resolution of 640*480 with two colors and an
adjustable palette (that means that the two colors can be chosen out of the
16 VDC colors). The driver requires 64KB VDC RAM.
</descrip><p>
Note: The colors are translated from definitions in headers to correct VDC values
so please use definitions or VIC color numbers only. Colors <tt/GRAY3/ and <tt/BROWN/ are
missing on VDC and are translated to the two colors missing from VIC palette.
Note: The colors are translated from definitions in headers to correct VDC values;
so, please use definitions or VIC color numbers only. Colors <tt/GRAY3/ and <tt/BROWN/ are
missing on VDC, and are translated to the two colors missing from the VIC palette.
<sect1>Extended memory drivers<p>
@ -217,8 +219,8 @@ missing on VDC and are translated to the two colors missing from VIC palette.
it has better knowledge about the hardware than the driver.
<tag><tt/c128-vdc.emd (c128_vdc_emd)/</tag>
A driver for the VDC memory of the C128 written and contributed by Maciej
Witkowiak. Autodetects the amount of memory available (16 or 64K) and offers
A driver for the VDC memory of the C128, written and contributed by Maciej
Witkowiak. Autodetects the amount of memory available (16 or 64K), and offers
64 or 256 pages of 256 bytes each. Note: This driver is incompatible with
any of the graphics drivers using the VDC!
@ -227,17 +229,18 @@ missing on VDC and are translated to the two colors missing from VIC palette.
<sect1>Joystick drivers<p>
The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c128-stdjoy.joy (c128_stdjoy_joy)/.
<descrip>
<tag><tt/c128-ptvjoy.joy (c128_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter originally written by Groepaz
for the C64 and converted for the C128 by me. See <htmlurl
url="http://www.protovision-online.de/hardw/hardwstart.htm"
name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
for the C64, and converted for the C128 by Uz. See <url
url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
building instructions. Up to four joysticks are supported.
<tag><tt/c128-stdjoy.joy (c128_stdjoy_joy)/</tag>
Supports up to two joysticks connected to the standard joysticks port of
Supports up to two joysticks connected to the standard joysticks ports of
the C128.
</descrip><p>
@ -246,6 +249,8 @@ missing on VDC and are translated to the two colors missing from VIC palette.
<sect1>Mouse drivers<p>
The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c128-1351.mou (c128_1351_mou)/.
<descrip>
<tag><tt/c128-1351.mou (c128_1351_mou)/</tag>
@ -259,11 +264,11 @@ missing on VDC and are translated to the two colors missing from VIC palette.
only the 40-column screen.
<tag><tt/c128-joy.mou (c128_joy_mou)/</tag>
Supports a mouse emulated by a standard joystick e.g. 1350 mouse in port
Supports a mouse emulated by a standard joystick, e.g. 1350 mouse, in port
#1 of the C128.
<tag><tt/c128-pot.mou (c128_pot_mou)/</tag>
Supports a potentiometer device e.g. Koala Pad connected to port #1 of
Supports a potentiometer device, e.g. Koala Pad, connected to port #1 of
the C128.
</descrip><p>
@ -274,10 +279,10 @@ missing on VDC and are translated to the two colors missing from VIC palette.
<descrip>
<tag><tt/c128-swlink.ser (c128_swlink_ser)/</tag>
Driver for the SwiftLink cartridge. Supports up to 38400 baud, hardware flow
control (RTS/CTS) and interrupt driven receives. Note that because of the
peculiarities of the 6551 chip together with the use of the NMI, transmits
are not interrupt driven, and the transceiver blocks if the receiver asserts
Driver for the SwiftLink cartridge. Supports up to 38400 BPS, hardware flow
control (RTS/CTS), and interrupt-driven receives. Note that, because of the
peculiarities of the 6551 chip, together with the use of the NMI, transmits
are not interrupt driven; and, the transceiver blocks if the receiver asserts
flow control because of a full buffer.
The driver uses the RS232 variables and buffers of the kernal (buffers at
@ -293,10 +298,11 @@ missing on VDC and are translated to the two colors missing from VIC palette.
<sect>Other hints<p>
<sect1>Passing arguments to the program<p>
Command line arguments can be passed to <tt/main()/. Since this is not
supported by BASIC, the following syntax was chosen:
Command-line arguments can be passed to <tt/main()/. Since this is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
@ -307,7 +313,7 @@ supported by BASIC, the following syntax was chosen:
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main/ is the program name.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
@ -325,7 +331,7 @@ The runtime for the C128 uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -3,8 +3,8 @@
<article>
<title>Commodore 16/116 specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2003-12-15
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-10
<abstract>
An overview over the C16 runtime system as it is implemented for the cc65 C
@ -23,13 +23,13 @@ cc65 C compiler. It describes the memory layout, C16/116 specific header
files, available drivers, and any pitfalls specific to that platform.
Please note that C16 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
Since the C16/C116 and the Commodore Plus/4 are almost identical (the former
don't have the 6551 ACIA and only 16KB of memory), the <htmlurl
don't have the 6551 ACIA and only 16KB of memory), the <url
url="plus4.html" name="Plus/4 documentation"> is also worth a look. The
difference between both cc65 targets is that the Plus/4 runtime uses banking
to support full 64K RAM, while the C16 does not use banking and supports up to
@ -97,7 +97,7 @@ There are currently no special C16/C116 functions.
<sect1>CBM specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
<itemize>
@ -232,7 +232,7 @@ The runtime for the C16 uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -2,9 +2,9 @@
<article>
<title>Commodore 64 specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2003-09-23
<title>Commodore 64-specific information for cc65
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-14
<abstract>
An overview over the C64 runtime system as it is implemented for the cc65 C
@ -19,11 +19,11 @@ compiler.
<sect>Overview<p>
This file contains an overview of the C64 runtime system as it comes with the
cc65 C compiler. It describes the memory layout, C64 specific header files,
cc65 C compiler. It describes the memory layout, C64-specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that C64 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that C64-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -117,17 +117,17 @@ Please note that in this case a changed start address doesn't make sense,
since the program must be loaded to the BASIC start address.
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing C64 specific code may use the <tt/c64.h/ or <tt/cbm.h/
Programs containing C64-specific code may use the <tt/c64.h/ or <tt/cbm.h/
header files. Using the later may be an option when writing code for more than
one CBM platform, since it includes <tt/c64.h/ and declares several functions
common to all CBM platforms.
<sect1>C64 specific functions<p>
<sect1>C64-specific functions<p>
The functions listed below are special for the C64. See the <htmlurl
The functions listed below are special for the C64. See the <url
url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
@ -135,10 +135,10 @@ url="funcref.html" name="function reference"> for declaration and usage.
</itemize>
<sect1>CBM specific functions<p>
<sect1>CBM-specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
<itemize>
@ -268,18 +268,18 @@ configuration.
<sect1>Joystick drivers<p>
The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/c64-stdjoy.joy (c64_stdjoy_joy)/.
<descrip>
<tag><tt/c64-hitjoy.joy (c64_hitjoy_joy)/</tag>
Driver for the Digital Excess & Hitmen adapter contributed by Groepaz. See
<htmlurl url="http://www.digitalexcess.de/downloads/productions.php"
name="http://www.digitalexcess.de/downloads/productions.php"> on
Driver for the Digital Excess &amp; Hitmen adapter contributed by Groepaz.
See <url url="http://www.digitalexcess.de/downloads/productions.php"> on
instructions how to build one. Up to four joysticks are supported.
<tag><tt/c64-ptvjoy.joy (c64_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter contributed by Groepaz. See
<htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm"
name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
<url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
building instructions. Up to four joysticks are supported.
<tag><tt/c64-stdjoy.joy (c64_stdjoy_joy)/</tag>
@ -295,6 +295,8 @@ configuration.
<sect1>Mouse drivers<p>
The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/c64-1351.mou (c64_1351_mou)/.
<descrip>
<tag><tt/c64-1351.mou (c64_1351_mou)/</tag>
@ -307,11 +309,11 @@ configuration.
joystick left-button pin or the paddle Y [up/down] pin.)
<tag><tt/c64-joy.mou (c64_joy_mou)/</tag>
Supports a mouse emulated by a standard joystick e.g. 1350 mouse in port
Supports a mouse emulated by a standard joystick, e.g. 1350 mouse, in port
#1 of the C64.
<tag><tt/c64-pot.mou (c64_pot_mou)/</tag>
Supports a potentiometer device e.g. Koala Pad connected to port #1 of
Supports a potentiometer device, e.g. Koala Pad, connected to port #1 of
the C64.
</descrip><p>
@ -322,10 +324,10 @@ configuration.
<descrip>
<tag><tt/c64-swlink.ser (c64_swlink_ser)/</tag>
Driver for the SwiftLink cartridge. Supports up to 38400 baud, hardware flow
control (RTS/CTS) and interrupt driven receives. Note that because of the
peculiarities of the 6551 chip together with the use of the NMI, transmits
are not interrupt driven, and the transceiver blocks if the receiver asserts
Driver for the SwiftLink cartridge. Supports up to 38400 BPS, hardware flow
control (RTS/CTS), and interrupt-driven receives. Note that, because of the
peculiarities of the 6551 chip, together with the use of the NMI, transmits
are not interrupt driven; and, the transceiver blocks if the receiver asserts
flow control because of a full buffer.
</descrip><p>
@ -338,14 +340,16 @@ configuration.
<sect>Other hints<p>
<sect1>Escape code<p>
For an Esc press CTRL and [ key.
For an Esc, press CTRL and the <tt/[/ key.
<sect1>Passing arguments to the program<p>
Command line arguments can be passed to <tt/main()/. Since this is not
supported by BASIC, the following syntax was chosen:
Command-line arguments can be passed to <tt/main()/. Since this is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
@ -356,7 +360,7 @@ supported by BASIC, the following syntax was chosen:
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main/ is the program name.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
@ -374,7 +378,7 @@ The runtime for the C64 uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -2,8 +2,8 @@
<article>
<title>ca65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2000-07-19, 2000-11-29, 2001-10-02, 2005-09-08
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-10
<abstract>
ca65 is a powerful macro assembler for the 6502, 65C02 and 65816 CPUs. It is
@ -453,9 +453,8 @@ mnemonics:
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 <htmlurl
url="http://www.oxyron.de/html/opcodes02.html"
name="http://www.oxyron.de/html/opcodes02.html">. Please note that only 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.
@ -502,8 +501,7 @@ nor does it call the interpreter. All this must be done by your program. Apple
][ programmers do probably know how to use sweet16 mode.
For more information about SWEET 16, see
<htmlurl url="http://www.6502.org/source/interpreters/sweet16.htm"
name="http://www.6502.org/source/interpreters/sweet16.htm">.
<url url="http://www.6502.org/source/interpreters/sweet16.htm">.
<sect1>Number format<p>

View file

@ -3,10 +3,11 @@
<article>
<title>Commodore 510 (aka P500) specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">&nl;
Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">&nl;
<htmlurl url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2013-08-23
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2014-04-02
<abstract>
An overview over the Commodore 510 runtime system as it is implemented for the
@ -21,11 +22,11 @@ cc65 C compiler.
<sect>Overview<p>
This file contains an overview of the CBM 510 runtime system as it comes with
the cc65 C compiler. It describes the memory layout, CBM 510 specific header
the cc65 C compiler. It describes the memory layout, CBM 510-specific header
files, available drivers, and any pitfalls specific to that platform.
Please note that CBM 510 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that CBM 510-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -38,10 +39,10 @@ machines are supported by this cc65 target.
<sect>Binary format<p>
The standard binary output format generated by the linker for the Commodore
510 target is a machine language program with a one line BASIC stub, which
transfers control to the machine language running in bank 0. This means that a
program can be loaded as BASIC program and started with RUN. It is of course
possible to change this behaviour by using a modified startup file and linker
510 target is a machine language program with a one-line BASIC stub, which
transfers control to the machine language running in bank 0. That means that a
program can be loaded as a BASIC program, and started with RUN. It is, of course,
possible to change that behaviour by using a modified startup file and linker
config.
@ -58,7 +59,7 @@ The default memory configuration for the CBM 510 allocates all memory between
in low memory is lost, because a separate hardware stack is set up in page 1,
and the kernal replacement functions need some more memory locations. A few
more pages are lost in high memory, because the runtime sets up a copy of the
character ROM, a text screen and a CBM compatible jump table at &dollar;FF81.
character ROM, a text screen, and a CBM-compatible jump table at &dollar;FF81.
The main startup code is located at &dollar;0400, so about 54K of the complete
bank are actually usable for applications.
@ -66,25 +67,25 @@ Special locations:
<descrip>
<tag/Stack/
The C runtime stack is located at &dollar;FF81 and growing downwards.
The C runtime stack is located at &dollar;FF81, and grows downwards.
<tag/Heap/
The C heap is located at the end of the program and grows towards the C
The C heap is located at the end of the program, and grows towards the C
runtime stack.
</descrip><p>
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing CBM 510 specific code may use the <tt/cbm510.h/ or
Programs containing CBM 510-specific code may use the <tt/cbm510.h/ or
<tt/cbm.h/ header files. Using the later may be an option when writing code
for more than one CBM platform, since it includes <tt/cbm510.h/ and declares
for more than one CBM platform, since it includes <tt/cbm510.h/, and declares
several functions common to all CBM platforms.
<sect1>CBM 510 specific functions<p>
<sect1>CBM 510-specific functions<p>
The functions listed below are special for the CBM 510. See the <htmlurl
The functions listed below are special for the CBM 510. See the <url
url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
@ -95,10 +96,10 @@ url="funcref.html" name="function reference"> for declaration and usage.
</itemize>
<sect1>CBM specific functions<p>
<sect1>CBM-specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
@ -133,11 +134,11 @@ declaration and usage.
The following pseudo variables declared in the <tt/cbm510.h/ header file do
allow access to hardware located in the address space. Some variables are
structures, accessing the struct fields will access the chip registers.
structures; accessing the struct fields will access the chip registers.
<bf>Note:</bf> All I/O chips are located in the system bank (bank 15) and can
<bf>Note:</bf> All I/O chips are located in the system bank (bank 15); and can
therefore not be accessed like on other platforms. Please use one of the
<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/ and <tt/pokewsys/ functions to
<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/, and <tt/pokewsys/ functions to
access the I/O chips. Direct reads and writes to the structures named below
will <em>not</em> work!
@ -164,7 +165,7 @@ will <em>not</em> work!
declaration of the structure.
<tag><tt/TPI1, TPI2/</tag>
The two 6525 triport chips may be accessed by using this variable. See the
The two 6525 triport chips may be accessed by using these variables. See the
<tt/_6525.h/ header file located in the include directory for the
declaration of the structure.
@ -196,7 +197,7 @@ No graphics drivers are currently available for the Commodore 510.
<descrip>
<tag><tt/cbm510-std.joy (cbm510_std_joy)/</tag>
Supports up to two standard joysticks connected to the joysticks port of
Supports up to two standard joysticks connected to the joysticks ports of
the Commodore 510.
</descrip><p>
@ -204,6 +205,8 @@ No graphics drivers are currently available for the Commodore 510.
<sect1>Mouse drivers<p>
The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/cbm510-joy.mou (cbm510_joy_mou)/.
<descrip>
<tag><tt/cbm510-joy.mou (cbm510_joy_mou)/</tag>
@ -220,20 +223,22 @@ No graphics drivers are currently available for the Commodore 510.
</descrip><p>
<sect1>RS232 device drivers<p>
<descrip>
<tag><tt/cbm510-std.ser (cbm510_std_ser)/</tag>
Driver for the 6551 ACIA chip built into the Commodore 510. Supports up to
19200 baud, hardware flow control (RTS/CTS) and interrupt driven receives.
Note that because of the peculiarities of the 6551 chip transmits are not
interrupt driven, and the transceiver blocks if the receiver asserts flow
19200 BPS, hardware flow control (RTS/CTS), and interrupt-driven receives.
Note that, because of the peculiarities of the 6551 chip, transmits are not
interrupt driven; and, the transceiver blocks if the receiver asserts flow
control because of a full buffer.
</descrip><p>
<sect>Limitations<label id="limitations"><p>
@ -243,27 +248,44 @@ Since the program runs in bank 0, and the kernal and all I/O chips are located
in bank 15, calling ROM routines or accessing hardware needs special code. The
cc65 runtime implements wrappers for all functions in the kernal jump table.
While this simplifies things, it should be noted that the wrappers do have
quite an impact on performance: A cross bank call has an extra 300&micro;s
quite an impact on performance: A cross-bank call has an extra 300&micro;s
penalty added by the wrapper.
<sect1>Interrupts<p>
Compiled programs contain an interrupt handler that runs in the program bank.
This has several advantages, one of them being performance (see cross bank
This has several advantages, one of them being performance (see cross-bank
call overhead mentioned above). However, this introduces one problem:
Interrupts are lost while the CPU executes code in the kernal bank. As a
result, the clock may go wrong and (worse) serial interrupts may get lost.
result, the clock may go wrong; and (worse), serial interrupts may get lost.
Since the cc65 runtime does only call the kernal for disk I/O, this means that
a program should not do file I/O while it depends on interrupts.
<sect>Other hints<p>
<sect1>Passing arguments to the program<p>
Command line argument passing is currently not supported for the Commodore
510.
Command-line arguments can be passed to <tt/main()/. Since that is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
</verb></tscreen>
<enum>
<item>Arguments are separated by spaces.
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
<sect1>Program return code<p>
@ -278,7 +300,7 @@ The runtime for the Commodore 510 uses routines marked as <tt/.INTERRUPTOR/
for interrupt handlers. Such routines must be written as simple machine
language subroutines and will be called automatically by the interrupt handler
code when they are linked into a program. See the discussion of the
<tt/.CONDES/ feature in the <htmlurl url="ca65.html" name="assembler manual">.
<tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -2,9 +2,11 @@
<article>
<title>Commodore 610 specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2003-12-16
<title>Commodore 610-specific information for cc65
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2014-04-02
<abstract>
An overview over the Commodore 610 runtime system as it is implemented for the
@ -19,11 +21,11 @@ cc65 C compiler.
<sect>Overview<p>
This file contains an overview of the CBM 610 runtime system as it comes with
the cc65 C compiler. It describes the memory layout, CBM 610 specific header
the cc65 C compiler. It describes the memory layout, CBM 610-specific header
files, available drivers, and any pitfalls specific to that platform.
Please note that CBM 610 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that CBM 610-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -31,21 +33,22 @@ information.
In addition to the Commodore 610 (named B40 in the U.S.), several other
machines are supported by this cc65 target, since they have identical
hardware: The Commodore 620 and 630 (more memory, additional coprocessor
card), and the Commodore 710, 720 and 730 (same hardware in another case with
a builtin monitor).
card), and the Commodore 710, 720, and 730 (same hardware in another case with
a built-in monitor).
<sect>Binary format<p>
The standard binary output format generated by the linker for the Commodore
610 target is a machine language program with a one line BASIC stub, which
transfers control to the machine language running in bank 1. This means that a
program can be loaded as BASIC program and started with RUN. It is of course
possible to change this behaviour by using a modified startup file and linker
610 target is a machine language program with a one-line BASIC stub, which
transfers control to the machine language running in bank 1. That means that a
program can be loaded as a BASIC program, and started with RUN. It is, of course,
possible to change that behaviour by using a modified startup file and linker
config.
<sect>Memory layout<p>
cc65 generated programs for the Commodore 610 run in bank 1, the memory bank
@ -57,8 +60,8 @@ The default memory configuration for the CBM 610 allocates all memory between
&dollar;0002 and &dollar;FFF0 in bank 1 for the compiled program. Some space
in low memory is lost, because a separate hardware stack is set up in page 1,
and the kernal replacement functions need some more memory locations. A few
more bytes are lost in high memory, because the runtime sets up a CBM
compatible jump table at &dollar;FF81. The main startup code is located at
more bytes are lost in high memory, because the runtime sets up a CBM-compatible
jump table at &dollar;FF81. The main startup code is located at
&dollar;0400, so about 63K of the complete bank are actually usable for
applications.
@ -66,25 +69,26 @@ Special locations:
<descrip>
<tag/Stack/
The C runtime stack is located at &dollar;FF81 and growing downwards.
The C runtime stack is located at &dollar;FF81, and grows downwards.
<tag/Heap/
The C heap is located at the end of the program and grows towards the C
The C heap is located at the end of the program, and grows towards the C
runtime stack.
</descrip><p>
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing CBM 610 specific code may use the <tt/cbm610.h/ or
Programs containing CBM 610-specific code may use the <tt/cbm610.h/ or
<tt/cbm.h/ header files. Using the later may be an option when writing code
for more than one CBM platform, since it includes <tt/cbm610.h/ and declares
for more than one CBM platform, since it includes <tt/cbm610.h/, and declares
several functions common to all CBM platforms.
<sect1>CBM 610 specific functions<p>
The functions listed below are special for the CBM 610. See the <htmlurl
<sect1>CBM 610-specific functions<p>
The functions listed below are special for the CBM 610. See the <url
url="funcref.html" name="function reference"> for declaration and usage.
<itemize>
@ -95,10 +99,10 @@ url="funcref.html" name="function reference"> for declaration and usage.
</itemize>
<sect1>CBM specific functions<p>
<sect1>CBM-specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
@ -128,16 +132,15 @@ declaration and usage.
</itemize>
<sect1>Hardware access<p>
The following pseudo variables declared in the <tt/cbm610.h/ header file do
allow access to hardware located in the address space. Some variables are
structures, accessing the struct fields will access the chip registers.
structures; accessing the struct fields will access the chip registers.
<bf>Note:</bf> All I/O chips are located in the system bank (bank 15) and can
<bf>Note:</bf> All I/O chips are located in the system bank (bank 15); and can
therefore not be accessed like on other platforms. Please use one of the
<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/ and <tt/pokewsys/ functions to
<tt/peekbsys/, <tt/peekwsys/, <tt/pokebsys/, and <tt/pokewsys/ functions to
access the I/O chips. Direct reads and writes to the structures named below
will <em>not</em> work!
@ -163,7 +166,7 @@ will <em>not</em> work!
declaration of the structure.
<tag><tt/TPI1, TPI2/</tag>
The two 6525 triport chips may be accessed by using this variable. See the
The two 6525 triport chips may be accessed by using these variables. See the
<tt/_6525.h/ header file located in the include directory for the
declaration of the structure.
@ -180,7 +183,7 @@ The names in the parentheses denote the symbols to be used for static linking of
No graphics drivers are currently available for the Commodore 610 (and since
the machine has no graphics capabilities, chances for a graphics driver aren't
really good:-).
really good :-).
<sect1>Extended memory drivers<p>
@ -194,9 +197,8 @@ really good:-).
<sect1>Joystick drivers<p>
The Commodore 610 is a business machine and doesn't have joystick ports. There
are no drivers for the non existing ports available.
The Commodore 610 is a business machine, and doesn't have joystick ports. There
are no drivers for the non-existing ports available.
<sect1>Mouse drivers<p>
@ -210,14 +212,15 @@ No mouse drivers are currently available for the Commodore 610.
<tag><tt/cbm610-std.ser (cbm610_std_ser)/</tag>
Driver for the 6551 ACIA chip built into the Commodore 610. Supports up to
19200 baud, hardware flow control (RTS/CTS) and interrupt driven receives.
Note that because of the peculiarities of the 6551 chip transmits are not
interrupt driven, and the transceiver blocks if the receiver asserts flow
19200 BPS, hardware flow control (RTS/CTS), and interrupt-driven receives.
Note that, because of the peculiarities of the 6551 chip, transmits are not
interrupt driven; and, the transceiver blocks if the receiver asserts flow
control because of a full buffer.
</descrip><p>
<sect>Limitations<label id="limitations"><p>
@ -227,27 +230,44 @@ Since the program runs in bank 1, and the kernal and all I/O chips are located
in bank 15, calling ROM routines or accessing hardware needs special code. The
cc65 runtime implements wrappers for all functions in the kernal jump table.
While this simplifies things, it should be noted that the wrappers do have
quite an impact on performance: A cross bank call has an extra 300&micro;s
quite an impact on performance: A cross-bank call has an extra 300&micro;s
penalty added by the wrapper.
<sect1>Interrupts<p>
Compiled programs contain an interrupt handler that runs in the program bank.
This has several advantages, one of them being performance (see cross bank
This has several advantages, one of them being performance (see cross-bank
call overhead mentioned above). However, this introduces one problem:
Interrupts are lost while the CPU executes code in the kernal bank. As a
result, the clock may go wrong and (worse) serial interrupts may get lost.
result, the clock may go wrong; and (worse), serial interrupts may get lost.
Since the cc65 runtime does only call the kernal for disk I/O, this means that
a program should not do file I/O while it depends on interrupts.
<sect>Other hints<p>
<sect1>Passing arguments to the program<p>
Command line argument passing is currently not supported for the Commodore
610.
Command-line arguments can be passed to <tt/main()/. Since that is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
</verb></tscreen>
<enum>
<item>Arguments are separated by spaces.
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
<sect1>Program return code<p>
@ -262,7 +282,7 @@ The runtime for the Commodore 610 uses routines marked as <tt/.INTERRUPTOR/
for interrupt handlers. Such routines must be written as simple machine
language subroutines and will be called automatically by the interrupt handler
code when they are linked into a program. See the discussion of the
<tt/.CONDES/ feature in the <htmlurl url="ca65.html" name="assembler manual">.
<tt/.CONDES/ feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -2,7 +2,7 @@
<article>
<title>cc65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2000-09-03, 2001-10-02, 2005-08-01
<abstract>

View file

@ -2,7 +2,7 @@
<article>
<title>cl65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>01.08.2000, 27.11.2000, 02.10.2001
<abstract>

View file

@ -2,7 +2,7 @@
<article>
<title>co65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>12.02.2003
<abstract>

View file

@ -2,7 +2,7 @@
<article>
<title>cc65 coding hints
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2000-12-03, 2009-09-01
<abstract>

View file

@ -2,7 +2,7 @@
<article>
<title>da65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2003-08-08
<abstract>

View file

@ -3,8 +3,8 @@
<article>
<title>Using emulators with cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>03.12.2000
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-11
<abstract>
How to debug your code using the VICE and Oricutron emulators.
@ -29,7 +29,7 @@ Win32, OS/2, Acorn RISC OS, BeOS, QNX 6.x, Amiga, GP2X and Mac OS X. It emulates
the Commodore 64, 128, VIC20, PET and the 600/700 machines. For more information
see the VICE home page:
<htmlurl url="http://www.viceteam.org/">
<url url="http://vice-emu.sourceforge.net/">.
VICE has a builtin machine language monitor that may be used for debugging
your programs. Using an emulator for debugging has some advantages:

View file

@ -2,8 +2,8 @@
<article>
<title>Diskette Sector I/O Routines
<author>Christian Groessler, <htmlurl url="mailto:chris@groessler.org" name="chris@groessler.org">
<date>20-Feb-2005
<author><url url="mailto:chris@groessler.org" name="Christian Groessler">
<date>2014-04-10
<abstract>
The cc65 library provides functions to read and write raw disk sectors.
@ -89,8 +89,8 @@ The following function returns the sector size of the currently inserted disk:
</verb></tscreen>
On the Atari platform, the sector size is handled specially. Please refer
to the DIO section in the <htmlurl url="atari.html" name="Atari">
specific platform documentation.
to the DIO section in the <url url="atari.html" name="Atari-specific
platform documentation">.
<p>
The following function returns the sector count of the currently inserted disk:

View file

@ -2,8 +2,8 @@
<article>
<title>cc65 function reference
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>07.11.2002
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-10
<abstract>
cc65 is a C compiler for 6502 based systems. This function reference describes
@ -23,7 +23,7 @@ just some of the supported machines. This function refrence describes the
available functions together with any limitations.
For an overview about the available libraries, their purpose, and any
differences to the ISO standard, please have a look at the <htmlurl
differences to the ISO standard, please have a look at the <url
url="library.html" name="cc65 Library Overview">.
<bf/Note:/ Standard C functions are listed here, but not described in detail.
@ -276,8 +276,7 @@ function.
<sect1><tt/dio.h/<label id="dio.h"><p>
<htmlurl url="dio.html" name="dio.html">
Low-level disk I/O API.
<url url="dio.html" name="Low-level disk I/O API">.
<sect1><tt/dirent.h/<label id="dirent.h"><p>
@ -416,8 +415,8 @@ Low-level disk I/O API.
<sect1><tt/o65.h/<label id="o65.h"><p>
The <tt/o65.h/ header file contains structure and constant definitions that
may be used when dealing with files in <htmlurl
url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65 format">.
may be used when dealing with files in <url
url="http://www.6502.org/users/andre/o65/fileformat.html" name="the o65 format">.
It does not declare any functions.

View file

@ -5,8 +5,8 @@
<!-- Title information -->
<title>GEOSLib docs
<author>Maciej Witkowiak, <htmlurl url="mailto:ytm@elysium.pl" name="ytm@elysium.pl">
<date>v1.5, 26.12.1999, 2000, 2001, 2002, 2003, 2005
<author><url url="mailto:ytm@elysium.pl" name="Maciej Witkowiak">
<date>2014-04-11
<abstract>
This is the documentation of cc65's GEOSLib, but information contained here may be also
useful for writing GEOS applications in general.
@ -71,22 +71,19 @@ programs.
The software needed:
<itemize>
<item><em/cc65/ Excellent package containing a C crosscompiler, a crossassembler and a linker, you
can get it from: <htmlurl url="http://www.cc65.org/"
name="http://www.cc65.org/">
can get it from: <url url="http://cc65.github.io/cc65/">.
<item><em/VICE/ This is a portable C64, C128 and few other Commodore computers emulator, you
can obtain it from: <htmlurl url="http://www.viceteam.org/"
name="http://www.viceteam.org/">. The VICE package contains the
c1541 program that is able to convert/unconvert GEOS files to disk images.
can obtain it from: <url url="http://vice-emu.sourceforge.net/">.
The VICE package contains the <em/c1541/ program that is able
to convert/unconvert GEOS files to disk images.
<item><em/The Star Commander/ This tool is only for DOS. You will need it for transferring
object files from a PC to a 1541. There's also one important ability of this
tool - it automatically un-converts .cvt files into GEOS native format on
disk image files. Check out: <htmlurl url="http://sta.c64.org/sc.html"
name="http://sta.c64.org/sc.html">
<item><em/cbm4linux/ A Linux kernel module that allows for communication with a 1541 and
disk image files. Check out: <url url="http://sta.c64.org/sc.html">.
<item><em/opencbm/ A package that allows for communication directly with a 1541 and
other Commodore IEC bus drives. It can be a replacement for Star Commander if
you only want to transfer files to a disk and unconvert using GEOS program for
this purpose. Check out: <htmlurl url="http://www.lb.shuttle.de/puffin/cbm4linux/"
name="http://www.lb.shuttle.de/puffin/cbm4linux">
this purpose. Check out: <url url="http://opencbm.sourceforge.net/">.
</itemize>
<p>
VICE and cc65 are portable - they run on variety of platforms - DOS, Win32 and UNIX. GEOSLib only

View file

@ -4,8 +4,9 @@
<!-- Title information -->
<title>grc65 -- GEOS Resource Compiler
<author><url name="Maciej 'YTM/Elysium' Witkowiak" url="mailto:ytm@elysium.pl">
<and><url name="Greg King" url="mailto:gngking@erols.com">
<author>
<url url="mailto:ytm@elysium.pl" name="Maciej 'YTM/Elysium' Witkowiak">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>VII 2000; VI,VII 2002; 2005-8-3
<abstract>
This document describes a compiler that can create GEOS headers and menues for

View file

@ -2,7 +2,7 @@
<article>
<title>cc65 Documentation Overview
<author><htmlurl url="https://github.com/oliverschmidt/cc65" name="">
<author><url url="https://github.com/cc65/cc65/">
<date>
<sect>Program documentation<p>

View file

@ -3,9 +3,10 @@
<article>
<title>cc65 Compiler Intro
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">,
<and>CbmNut, <htmlurl url="mailto:cbmnut@hushmail.com" name="cbmnut@hushmail.com">,
<and><url name="Greg King" url="mailto:gngking@erols.com">
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:cbmnut@hushmail.com" name="CbmNut">,<newline>
<url url="mailto:greg.king5@verizon.net" name="Greg King">
<date>2005-7-22
<abstract>
@ -285,8 +286,8 @@ Apple:
BRUN TEST
</verb></tscreen>
You will see the "Hello, World!" appear on the same line. Thanks to Oliver
Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de"> for his help
You will see "Hello, World!" appear on the same line. Thanks to
<url url="mailto:ol.sc@web.de" name="Oliver Schmidt"> for his help
in completing this section.

View file

@ -2,8 +2,8 @@
<article>
<title>ld65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>02.12.2000, 02.10.2001
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-20
<abstract>
The ld65 linker combines object files into an executable file. ld65 is highly
@ -36,7 +36,7 @@ It complements the features that are built into the ca65 macroassembler:
the symbol was referenced.
<item> Flexible output. The output of ld65 is highly configurable by a config
file. More common platforms are supported by builtin configurations
file. Some more-common platforms are supported by default configurations
that may be activated by naming the target system. The output
generation was designed with different output formats in mind, so
adding other formats shouldn't be a great problem.
@ -47,7 +47,7 @@ It complements the features that are built into the ca65 macroassembler:
<sect>Usage<p>
<sect1>Command line option overview<p>
<sect1>Command-line option overview<p>
The linker is called as follows:
@ -93,9 +93,9 @@ Long options:
</verb></tscreen>
<sect1>Command line options in detail<p>
<sect1>Command-line options in detail<p>
Here is a description of all the command line options:
Here is a description of all of the command-line options:
<descrip>
@ -104,7 +104,7 @@ Here is a description of all the command line options:
Start a library group. The libraries specified within a group are searched
multiple times to resolve crossreferences within the libraries. Normally,
crossreferences are only resolved within a library, that is the library is
crossreferences are resolved only within a library, that is the library is
searched multiple times. Libraries specified later on the command line
cannot reference otherwise unreferenced symbols in libraries specified
earlier, because the linker has already handled them. Library groups are
@ -138,7 +138,7 @@ Here is a description of all the command line options:
<tag><tt>-o name</tt></tag>
The -o switch is used to give the name of the default output file.
Depending on your output configuration, this name may NOT be used as
Depending on your output configuration, this name <em/might not/ be used as the
name for the output file. However, for the default configurations, this
name is used for the output file name.
@ -162,8 +162,8 @@ Here is a description of all the command line options:
<item>c16 (works also for the c116 with memory up to 32K)
<item>c64
<item>c128
<item>cbm510 (CBM-II series with 40 column video)
<item>cbm610 (all CBM series-II computers with 80 column video)
<item>cbm510 (CBM-II series with 40-column video)
<item>cbm610 (all CBM series-II computers with 80-column video)
<item>geos-apple
<item>geos-cbm
<item>lunix
@ -186,15 +186,15 @@ Here is a description of all the command line options:
Force an import of a symbol. While object files are always linked to the
output file, regardless if there are any references, object modules from
libraries get only linked in if an import can be satisfied by this module.
The <tt/--fore-import/ option may be used to add a reference to a symbol and
The <tt/--force-import/ option may be used to add a reference to a symbol and
as a result force linkage of the module that exports the identifier.
The name of the symbol may optionally be followed by a colon and an address
size specifier. If no address size is specified, the default address size
The name of the symbol may optionally be followed by a colon and an address-size
specifier. If no address size is specified, the default address size
for the target machine is used.
Please note that the symbol name needs to have the internal representation,
meaning you have to prepend an underline for C identifiers.
meaning you have to prepend an underscore for C identifiers.
<label id="option-v">
@ -211,7 +211,9 @@ Here is a description of all the command line options:
Must be used in conjunction with <tt><ref id="option-m" name="-m"></tt>
(generate map file). Normally the map file will not include empty segments
and sections, or unreferenced symbols. Using this option, you can force the
linker to include all this information into the map file.
linker to include all that information into the map file. Also, it will
include a second <tt/Exports/ list. The first list is sorted by name;
the second one is sorted by value.
<label id="option-C">
@ -227,8 +229,8 @@ Here is a description of all the command line options:
This option allows to define an external symbol on the command line. Value
may start with a '&dollar;' sign or with <tt/0x/ for hexadecimal values,
otherwise a leading zero denotes octal values. See also the <ref
id="SYMBOLS" name="SYMBOLS section"> in the configuration file.
otherwise a leading zero denotes octal values. See also <ref
id="SYMBOLS" name="the SYMBOLS section"> in the configuration file.
<label id="option--lib-path">
@ -236,18 +238,18 @@ Here is a description of all the command line options:
Specify a library search path. This option may be used more than once. It
adds a directory to the search path for library files. Libraries specified
without a path are searched in current directory, in the directory given in
the <tt/LD65_LIB/ environment variable, and in the list of directories
specified using <tt/--lib-path/.
without a path are searched in the current directory, in the list of
directories specified using <tt/--lib-path/, in directories given by
environment variables, and in a built-in default directory.
<tag><tt>-Ln</tt></tag>
This option allows you to create a file that contains all global labels and
may be loaded into VICE emulator using the <tt/ll/ (load label) command. You
may be loaded into the VICE emulator using the <tt/ll/ (load label) command. You
may use this to debug your code with VICE. Note: Older versions had some
bugs in the label code. If you have problems, please get the latest VICE
version.
bugs in the label code. If you have problems, please get the latest <url
url="http://vice-emu.sourceforge.net/" name="VICE"> version.
<label id="option-S">
@ -261,7 +263,7 @@ Here is a description of all the command line options:
<tag><tt>-V, --version</tt></tag>
This option print the version number of the linker. If you send any
This option prints the version number of the linker. If you send any
suggestions or bugfixes, please include this number.
@ -271,9 +273,9 @@ Here is a description of all the command line options:
Specify a config file search path. This option may be used more than once.
It adds a directory to the search path for config files. A config file given
with the <tt><ref id="option-C" name="-C"></tt> option that has no path in
its name is searched in the current directory, in the directory given in the
<tt/LD65_CFG/ environment variable, and in the list of directories specified
using <tt/--cfg-path/.
its name is searched in the current directory, in the list of directories
specified using <tt/--cfg-path/, in directories given by environment variables,
and in a built-in default directory.
<label id="option--dbgfile">
@ -288,14 +290,14 @@ Here is a description of all the command line options:
<tag><tt>--lib file</tt></tag>
Links a library to the output. Use this command line option instead of just
Links a library to the output. Use this command-line option instead of just
naming the library file, if the linker is not able to determine the file
type because of an unusual extension.
<tag><tt>--obj file</tt></tag>
Links an object file to the output. Use this command line option instead
Links an object file to the output. Use this command-line option instead
of just naming the object file, if the linker is not able to determine the
file type because of an unusual extension.
@ -305,9 +307,9 @@ Here is a description of all the command line options:
Specify an object file search path. This option may be used more than once.
It adds a directory to the search path for object files. An object file
passed to the linker that has no path in its name is searched in current
directory, in the directory given in the <tt/LD65_OBJ/ environment variable,
and in the list of directories specified using <tt/--obj-path/.
passed to the linker that has no path in its name is searched in the current
directory, in the list of directories specified using <tt/--obj-path/, in
directories given by environment variables, and in a built-in default directory.
</descrip>
@ -378,22 +380,22 @@ name is given (libraries are also recognized by a magic word, there are no
special naming conventions), all modules in the library are checked if an
export from this module would satisfy an import from other modules. All
modules where this is the case are marked. If duplicate identifiers are
found, the linker issues a warning.
found, the linker issues warnings.
This procedure (parsing and reading from left to right) does mean, that a
That procedure (parsing and reading from left to right) does mean that a
library may only satisfy references for object modules (given directly or from
a library) named <em/before/ that library. With the command line
<tscreen><verb>
ld65 crt0.o clib.lib test.o
ld65 crt0.o clib.lib test.o
</verb></tscreen>
the module test.o may not contain references to modules in the library
clib.lib. If this is the case, you have to change the order of the modules
the module <tt/test.o/ must not contain references to modules in the library
<tt/clib.lib/. But, if it does, you have to change the order of the modules
on the command line:
<tscreen><verb>
ld65 crt0.o test.o clib.lib
ld65 crt0.o test.o clib.lib
</verb></tscreen>
Step two is, to read the configuration file, and assign start addresses
@ -403,7 +405,7 @@ name="Configuration files">).
After that, the linker is ready to produce an output file. Before doing that,
it checks its data for consistency. That is, it checks for unresolved
externals (if the output format is not relocatable) and for symbol type
mismatches (for example a zero page symbol is imported by a module as absolute
mismatches (for example a zero-page symbol is imported by a module as an absolute
symbol).
Step four is, to write the actual target files. In this step, the linker will
@ -416,7 +418,7 @@ segments and symbols encountered.
And, last step, if you give the <tt><ref id="option-v" name="-v"></tt> switch
twice, you get a dump of the segment data. However, this may be quite
unreadable if you're not a developer:-)
unreadable if you're not a developer. :-)
@ -434,23 +436,23 @@ Case is ignored for keywords, that is, section or attribute names, but it is
<sect1>Memory areas<p>
Memory areas are specified in a <tt/MEMORY/ section. Lets have a look at an
Memory areas are specified in a <tt/MEMORY/ section. Let's have a look at an
example (this one describes the usable memory layout of the C64):
<tscreen><verb>
MEMORY {
RAM1: start = $0800, size = $9800;
ROM1: start = $A000, size = $2000;
RAM2: start = $C000, size = $1000;
ROM2: start = $E000, size = $2000;
}
MEMORY {
RAM1: start = $0800, size = $9800;
ROM1: start = $A000, size = $2000;
RAM2: start = $C000, size = $1000;
ROM2: start = $E000, size = $2000;
}
</verb></tscreen>
As you can see, there are two ram areas and two rom areas. The names
As you can see, there are two RAM areas and two ROM areas. The names
(before the colon) are arbitrary names that must start with a letter, with
the remaining characters being letters or digits. The names of the memory
areas are used when assigning segments. As mentioned above, case is
significant for these names.
significant for those names.
The syntax above is used in all sections of the config file. The name
(<tt/ROM1/ etc.) is said to be an identifier, the remaining tokens up to the
@ -461,22 +463,22 @@ mark the end of the attributes for one identifier. The section above may also
have looked like this:
<tscreen><verb>
# Start of memory section
MEMORY
{
RAM1:
start $0800
size $9800;
ROM1:
start $A000
size $2000;
RAM2:
start $C000
size $1000;
ROM2:
start $E000
size $2000;
}
# Start of memory section
MEMORY
{
RAM1:
start $0800
size $9800;
ROM1:
start $A000
size $2000;
RAM2:
start $C000
size $1000;
ROM2:
start $E000
size $2000;
}
</verb></tscreen>
There are of course more attributes for a memory section than just start and
@ -495,26 +497,26 @@ we will start to assign segments to memory sections in the <tt/SEGMENTS/
section:
<tscreen><verb>
SEGMENTS {
CODE: load = RAM1, type = ro;
RODATA: load = RAM1, type = ro;
DATA: load = RAM1, type = rw;
BSS: load = RAM1, type = bss, define = yes;
}
SEGMENTS {
CODE: load = RAM1, type = ro;
RODATA: load = RAM1, type = ro;
DATA: load = RAM1, type = rw;
BSS: load = RAM1, type = bss, define = yes;
}
</verb></tscreen>
What we are doing here is telling the linker, that all segments go into the
<tt/RAM1/ memory area in the order specified in the <tt/SEGMENTS/ section. So
the linker will first write the <tt/CODE/ segment, then the <tt/RODATA/
segment, then the <tt/DATA/ segment - but it will not write the <tt/BSS/
segment. Why? Enter the segment type: For each segment specified, you may also
segment. Why? Here enters the segment type: For each segment specified, you may also
specify a segment attribute. There are four possible segment attributes:
<tscreen><verb>
ro means readonly
rw means read/write
bss means that this is an uninitialized segment
zp a zeropage segment
ro means readonly
rw means read/write
bss means that this is an uninitialized segment
zp a zeropage segment
</verb></tscreen>
So, because we specified that the segment with the name BSS is of type bss,
@ -531,19 +533,19 @@ a warning if this is not the case.
For a <tt/bss/ type segment to be useful, it must be cleared somehow by your
program (this happens usually in the startup code - for example the startup
code for cc65 generated programs takes care about that). But how does your
code for cc65-generated programs takes care about that). But how does your
code know, where the segment starts, and how big it is? The linker is able to
give that information, but you must request it. This is, what we're doing with
the "<tt/define = yes/" attribute in the <tt/BSS/ definitions. For each
segment, where this attribute is true, the linker will export three symbols.
<tscreen><verb>
__NAME_LOAD__ This is set to the address where the
segment is loaded.
__NAME_RUN__ This is set to the run address of the
segment. We will cover run addresses
later.
__NAME_SIZE__ This is set to the segment size.
__NAME_LOAD__ This is set to the address where the
segment is loaded.
__NAME_RUN__ This is set to the run address of the
segment. We will cover run addresses
later.
__NAME_SIZE__ This is set to the segment size.
</verb></tscreen>
Replace <tt/NAME/ by the name of the segment, in the example above, this would
@ -562,23 +564,23 @@ simple configuration like the one above. There is an additional attribute
write the area data into. If there is no file name given, the linker will
assign the default file name. This is "a.out" or the one given with the
<tt><ref id="option-o" name="-o"></tt> option on the command line. Since the
default behaviour is ok for our purposes, I did not use the attribute in the
default behaviour is OK for our purposes, I did not use the attribute in the
example above. Let's have a look at it now.
The "file" attribute (the keyword may also be written as "FILE" if you like
that better) takes a string enclosed in double quotes (`"') that specifies the
that better) takes a string enclosed in double quotes (`&dquot;') that specifies the
file, where the data is written. You may specify the same file several times,
in that case the data for all memory areas having this file name is written
into this file, in the order of the memory areas defined in the <tt/MEMORY/
section. Let's specify some file names in the <tt/MEMORY/ section used above:
<tscreen><verb>
MEMORY {
RAM1: start = $0800, size = $9800, file = %O;
ROM1: start = $A000, size = $2000, file = "rom1.bin";
RAM2: start = $C000, size = $1000, file = %O;
ROM2: start = $E000, size = $2000, file = "rom2.bin";
}
MEMORY {
RAM1: start = $0800, size = $9800, file = %O;
ROM1: start = $A000, size = $2000, file = "rom1.bin";
RAM2: start = $C000, size = $1000, file = %O;
ROM2: start = $E000, size = $2000, file = "rom2.bin";
}
</verb></tscreen>
The <tt/%O/ used here is a way to specify the default behaviour explicitly:
@ -603,10 +605,10 @@ name to that memory area.
The <tt/%O/ sequence is also allowed inside a string. So using
<tscreen><verb>
MEMORY {
ROM1: start = $A000, size = $2000, file = "%O-1.bin";
ROM2: start = $E000, size = $2000, file = "%O-2.bin";
}
MEMORY {
ROM1: start = $A000, size = $2000, file = "%O-1.bin";
ROM2: start = $E000, size = $2000, file = "%O-2.bin";
}
</verb></tscreen>
would write two files that start with the name of the output file specified on
@ -624,17 +626,17 @@ read/write data. But now, if the code is in ROM, we must care about it.
Remember the default segments (you may of course specify your own):
<tscreen><verb>
CODE read only code
RODATA read only data
DATA read/write data
BSS uninitialized data, read/write
CODE read-only code
RODATA read-only data
DATA read/write data
BSS uninitialized data, read/write
</verb></tscreen>
Since <tt/BSS/ is not initialized, we must not care about it now, but what
about <tt/DATA/? <tt/DATA/ contains initialized data, that is, data that was
explicitly assigned a value. And your program will rely on these values on
startup. Since there's no other way to remember the contents of the data
segment, than storing it into one of the ROMs, we have to put it there. But
startup. Since there's no way to remember the contents of the data segment,
other than storing it into one of the ROMs, we have to put it there. But
unfortunately, ROM is not writable, so we have to copy it into RAM before
running the actual code.
@ -648,12 +650,12 @@ you don't specify a "<tt/run/" attribute, the linker assumes that load area
and run area are the same. We will use this feature for our data area:
<tscreen><verb>
SEGMENTS {
CODE: load = ROM1, type = ro;
RODATA: load = ROM2, type = ro;
DATA: load = ROM2, run = RAM2, type = rw, define = yes;
BSS: load = RAM2, type = bss, define = yes;
}
SEGMENTS {
CODE: load = ROM1, type = ro;
RODATA: load = ROM2, type = ro;
DATA: load = ROM2, run = RAM2, type = rw, define = yes;
BSS: load = RAM2, type = bss, define = yes;
}
</verb></tscreen>
Let's have a closer look at this <tt/SEGMENTS/ section. We specify that the
@ -670,12 +672,12 @@ Since we have set this attribute to true, the linker will define three
external symbols for the data segment that may be accessed from your code:
<tscreen><verb>
__DATA_LOAD__ This is set to the address where the segment
is loaded, in this case, it is an address in
ROM2.
__DATA_RUN__ This is set to the run address of the segment,
in this case, it is an address in RAM2.
__DATA_SIZE__ This is set to the segment size.
__DATA_LOAD__ This is set to the address where the segment
is loaded, in this case, it is an address in
ROM2.
__DATA_RUN__ This is set to the run address of the segment,
in this case, it is an address in RAM2.
__DATA_SIZE__ This is set to the segment size.
</verb></tscreen>
So, what your startup code must do, is to copy <tt/__DATA_SIZE__/ bytes from
@ -694,25 +696,25 @@ There are some other attributes not covered above. Before starting the
reference section, I will discuss the remaining things here.
You may request symbols definitions also for memory areas. This may be
useful for things like a software stack, or an i/o area.
useful for things like a software stack, or an I/O area.
<tscreen><verb>
MEMORY {
STACK: start = $C000, size = $1000, define = yes;
}
MEMORY {
STACK: start = $C000, size = $1000, define = yes;
}
</verb></tscreen>
This will define some external symbols that may be used in your code:
<tscreen><verb>
__STACK_START__ This is set to the start of the memory
area, $C000 in this example.
__STACK_SIZE__ The size of the area, here $1000.
__STACK_LAST__ This is NOT the same as START+SIZE.
Instead, it it defined as the first
address that is not used by data. If we
don't define any segments for this area,
the value will be the same as START.
__STACK_START__ This is set to the start of the memory
area, $C000 in this example.
__STACK_SIZE__ The size of the area, here $1000.
__STACK_LAST__ This is NOT the same as START+SIZE.
Instead, it is defined as the first
address that is not used by data. If we
don't define any segments for this area,
the value will be the same as START.
__STACK_FILEOFFS__ The binary offset in the output file. This
is not defined for relocatable output file
formats (o65).
@ -721,8 +723,8 @@ This will define some external symbols that may be used in your code:
A memory section may also have a type. Valid types are
<tscreen><verb>
ro for readonly memory
rw for read/write memory.
ro for readonly memory
rw for read/write memory.
</verb></tscreen>
The linker will assure, that no segment marked as read/write or bss is put
@ -734,16 +736,16 @@ you don't like this, you may specify a byte value that is used to fill these
areas with the "<tt/fillval/" attribute. If there is no "<tt/fillval/"
attribute for the segment, the "<tt/fillval/" attribute of the memory area (or
its default) is used instead. This means that the value may also be used to
fill unfilled areas generated by the assemblers <tt/.ALIGN/ and <tt/.RES/
fill unfilled areas generated by the assembler's <tt/.ALIGN/ and <tt/.RES/
directives.
The symbol <tt/%S/ may be used to access the default start address (that is,
the one defined in the <ref id="FEATURES" name="FEATURES"> section, or the
the one defined in <ref id="FEATURES" name="the FEATURES section">, or the
value given on the command line with the <tt><ref id="option-S" name="-S"></tt>
option).
To support systems with banked memory, a special attribute named <tt/bank/ is
available. The attribute value is an arbitrary 32 bit integer. The assembler
available. The attribute value is an arbitrary 32-bit integer. The assembler
has a builtin function named <tt/.BANK/ which may be used with an argument
that has a segment reference (for example a symbol). The result of this
function is the value of the bank attribute for the run memory area of the
@ -757,13 +759,13 @@ request this feature. Num must be a power of two. To align all segments on a
page boundary, use
<tscreen><verb>
SEGMENTS {
CODE: load = ROM1, type = ro, align = $100;
RODATA: load = ROM2, type = ro, align = $100;
DATA: load = ROM2, run = RAM2, type = rw, define = yes,
align = $100;
BSS: load = RAM2, type = bss, define = yes, align = $100;
}
SEGMENTS {
CODE: load = ROM1, type = ro, align = $100;
RODATA: load = ROM2, type = ro, align = $100;
DATA: load = ROM2, run = RAM2, type = rw, define = yes,
align = $100;
BSS: load = RAM2, type = bss, define = yes, align = $100;
}
</verb></tscreen>
If an alignment is requested, the linker will add enough space to the output
@ -788,17 +790,17 @@ specified offset (this may happen if other segments in this area are too
large). Here's an example:
<tscreen><verb>
SEGMENTS {
VECTORS: load = ROM2, type = ro, start = $FFFA;
}
SEGMENTS {
VECTORS: load = ROM2, type = ro, start = $FFFA;
}
</verb></tscreen>
or (for the segment definitions from above)
<tscreen><verb>
SEGMENTS {
VECTORS: load = ROM2, type = ro, offset = $1FFA;
}
SEGMENTS {
VECTORS: load = ROM2, type = ro, offset = $1FFA;
}
</verb></tscreen>
The "<tt/align/", "<tt/start/" and "<tt/offset/" attributes change placement
@ -812,13 +814,13 @@ just the load memory area.
A "<tt/fillval/" attribute may not only be specified for a memory area, but
also for a segment. The value must be an integer between 0 and 255. It is used
as fill value for space reserved by the assemblers <tt/.ALIGN/ and <tt/.RES/
commands. It is also used as fill value for space between sections (part of a
as the fill value for space reserved by the assembler's <tt/.ALIGN/ and <tt/.RES/
commands. It is also used as the fill value for space between sections (part of a
segment that comes from one object file) caused by alignment, but not for
space that preceeds the first section.
To suppress the warning, the linker issues if it encounters a segment that is
not found in any of the input files, use "<tt/optional=yes/" as additional
not found in any of the input files, use "<tt/optional=yes/" as an additional
segment attribute. Be careful when using this attribute, because a missing
segment may be a sign of a problem, and if you're suppressing the warning,
there is no one left to tell you about it.
@ -834,32 +836,32 @@ each output file. Assigning binary format to the default output file would
look like this:
<tscreen><verb>
FILES {
%O: format = bin;
}
FILES {
%O: format = bin;
}
</verb></tscreen>
The only other available output format is the o65 format specified by Andre
Fachat (see the <htmlurl url="http://www.6502.org/users/andre/o65/fileformat.html"
Fachat (see the <url url="http://www.6502.org/users/andre/o65/fileformat.html"
name="6502 binary relocation format specification">). It is defined like this:
<tscreen><verb>
FILES {
%O: format = o65;
}
FILES {
%O: format = o65;
}
</verb></tscreen>
The necessary o65 attributes are defined in a special section labeled
<tt/FORMAT/.
<ref id="FORMAT" name="FORMAT">.
<sect1>The FORMAT section<p>
<sect1>The FORMAT section<label id="FORMAT"><p>
The <tt/FORMAT/ section is used to describe file formats. The default (binary)
format has currently no attributes, so, while it may be listed in this
section, the attribute list is empty. The second supported format,
<htmlurl url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65">,
<url url="http://www.6502.org/users/andre/o65/fileformat.html" name="o65">,
has several attributes that may be defined here.
<tscreen><verb>
@ -885,12 +887,12 @@ linker has features that may be enabled by an additional section labeled
tables.
<tscreen><verb>
FEATURES {
CONDES: segment = RODATA,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
}
FEATURES {
CONDES: segment = RODATA,
type = constructor,
label = __CONSTRUCTOR_TABLE__,
count = __CONSTRUCTOR_COUNT__;
}
</verb></tscreen>
The <tt/CONDES/ feature has several attributes:
@ -913,7 +915,7 @@ The <tt/CONDES/ feature has several attributes:
<tag><tt>label</tt></tag>
This specifies the label to use for the table. The label points to the start
of the table in memory and may be used from within user written code.
of the table in memory and may be used from within user-written code.
<tag><tt>count</tt></tag>
@ -926,7 +928,7 @@ The <tt/CONDES/ feature has several attributes:
<tag><tt>order</tt></tag>
Optional attribute that takes one of the keywords <tt/increasing/ or
An optional attribute that takes one of the keywords <tt/increasing/ or
<tt/decreasing/ as an argument. Specifies the sorting order of the entries
within the table. The default is <tt/increasing/, which means that the
entries are sorted with increasing priority (the first entry has the lowest
@ -940,7 +942,7 @@ The <tt/CONDES/ feature has several attributes:
<tag><tt>import</tt></tag>
This attribute defines a valid symbol name, that is added as an import
to the modules defining a constructor/desctructor of the given type.
to the modules defining a constructor/destructor of the given type.
This can be used to force linkage of a module if this module exports the
requested symbol.
@ -949,7 +951,7 @@ The <tt/CONDES/ feature has several attributes:
Without specifying the <tt/CONDES/ feature, the linker will not create any
tables, even if there are <tt/condes/ entries in the object files.
For more information see the <tt/.CONDES/ command in the <htmlurl
For more information see the <tt/.CONDES/ command in the <url
url="ca65.html" name="ca65 manual">.
@ -960,10 +962,10 @@ which can be referenced by the <tt/%S/ symbol. The builtin default for the
linker is &dollar;200.
<tscreen><verb>
FEATURES {
FEATURES {
# Default start address is $1000
STARTADDRESS: default = $1000;
}
STARTADDRESS: default = $1000;
}
</verb></tscreen>
Please note that order is important: The default start address must be defined
@ -1016,10 +1018,10 @@ the programmer to override the value by specifying <tt/--define
__STACKSIZE__=xxx/ on the command line.
<tscreen><verb>
SYMBOLS {
SYMBOLS {
# Define the stack size for the application
__STACKSIZE__: type = weak, value = $800;
}
__STACKSIZE__: type = weak, value = $800;
}
</verb></tscreen>

View file

@ -3,8 +3,8 @@
<article>
<title>cc65 Library Overview
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2000-12-02, 2002-11-26
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-12
<abstract>
An overview over the runtime and C libraries that come with the cc65 compiler,
@ -19,7 +19,7 @@ including a discussion of the differences to the ISO standard.
<sect>Overview<p>
This file contains a short overview of the libraries available for the cc65 C
compiler. Please have a look at the <htmlurl url="funcref.html" name="function
compiler. Please have a look at the <url url="funcref.html" name="function
reference"> for a list function by function. Since the function reference is
not complete (I'm working on that) it may happen that you don't find a
specific function. In this case, have a look into the header files. All

View file

@ -3,9 +3,10 @@
<article>
<title>Atari Lynx specific information for cc65
<author>Karri Kaksonen, <htmlurl url="mailto:karri@sipo.fi" name="karri@sipo.fi">
Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2011-04-01
<author>
<url url="mailto:karri@sipo.fi" name="Karri Kaksonen">,<newline>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-12
<abstract>
An overview over the Atari Lynx runtime system as it is implemented for the
@ -24,7 +25,7 @@ with the cc65 C compiler. It describes the memory layout, Lynx specific header
files, available drivers, and any pitfalls specific to that platform.
Please note that Lynx specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.

View file

@ -3,9 +3,10 @@
<article>
<title>Nintendo Entertainment System specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">
<date>2005-07-17
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2014-04-12
<abstract>
An overview over the NES runtime system as it is implemented for the
@ -24,7 +25,7 @@ with the cc65 C compiler. It describes the memory layout, NES specific header
files, available drivers, and any pitfalls specific to that platform.
Please note that NES specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.

View file

@ -2,12 +2,12 @@
<article>
<title>od65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2010-07-30
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-14
<abstract>
od65 is the object file dump utility. It is able to output most parts of
<htmlurl url="ca65.html" name="ca65"> generated object files in readable form.
<htmlurl url="ca65.html" name="ca65-generated"> object files in readable form.
</abstract>
<!-- Table of contents -->
@ -19,7 +19,7 @@ od65 is the object file dump utility. It is able to output most parts of
<sect>Overview<p>
od65 is an object file dump utility. It is able to output most parts of
<htmlurl url="ca65.html" name="ca65"> generated object files in readable form.
<htmlurl url="ca65.html" name="ca65-generated"> object files in readable form.
Since the contents and format of the object files are not documented
elsewhere and may change at any time, this tool is a portable way to look at
the contents.

View file

@ -2,10 +2,11 @@
<article>
<title>Commodore PET specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">
<date>2005-05-24
<title>Commodore PET-specific information for cc65
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2014-04-12
<abstract>
An overview over the PET runtime system as it is implemented for the cc65 C
@ -20,11 +21,11 @@ compiler.
<sect>Overview<p>
This file contains an overview of the PET runtime system as it comes with the
cc65 C compiler. It describes the memory layout, PET specific header files,
cc65 C compiler. It describes the memory layout, PET-specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that PET specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that PET-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -63,24 +64,24 @@ Special locations:
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing PET specific code may use the <tt/pet.h/ or <tt/cbm.h/
Programs containing PET-specific code may use the <tt/pet.h/ or <tt/cbm.h/
header files. Using the later may be an option when writing code for more than
one CBM platform, since it includes <tt/pet.h/ and declares several functions
common to all CBM platforms.
<sect1>PET specific functions<p>
<sect1>PET-specific functions<p>
There are currently no special PET functions.
<sect1>CBM specific functions<p>
<sect1>CBM-specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
<itemize>
@ -148,12 +149,13 @@ No extended memory drivers are currently available for the PET.
<sect1>Joystick drivers<p>
The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/pet-stdjoy.joy (pet_stdjoy_joy)/.
<descrip>
<tag><tt/pet-ptvjoy.joy (pet_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter contributed by Groepaz. See
<htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm"
name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
<url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
building instructions. Up to two joysticks are supported.
<tag><tt/pet-stdjoy.joy (pet_stdjoy_joy)/</tag>
@ -179,10 +181,11 @@ No serial drivers are currently available for the PET.
<sect>Other hints<p>
<sect1>Passing arguments to the program<p>
Command line arguments can be passed to <tt/main()/. Since this is not
supported by BASIC, the following syntax was chosen:
Command-line arguments can be passed to <tt/main()/. Since that is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
@ -193,7 +196,7 @@ supported by BASIC, the following syntax was chosen:
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main/ is the program name.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
@ -211,7 +214,7 @@ The runtime for the PET uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.
<sect1>Using extended memory<p>
@ -228,6 +231,7 @@ the following code:
</verb></tscreen>
<sect>License<p>
This software is provided 'as-is', without any expressed or implied

View file

@ -3,8 +3,8 @@
<article>
<title>Commodore Plus/4 specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<date>2003-12-14
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2014-04-12
<abstract>
An overview over the Plus/4 runtime system as it is implemented for the cc65 C
@ -23,13 +23,13 @@ cc65 C compiler. It describes the memory layout, Plus/4 specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that Plus/4 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
Since the Plus/4 and the Commodore 16/116 are almost identical (the latter are
missing the 6551 ACIA and do only have 16KB of memory), the <htmlurl
missing the 6551 ACIA and do only have 16KB of memory), the <url
url="c16.html" name="C16 documentation"> is also worth a look. The difference
between both cc65 targets is that the Plus/4 runtime uses banking to support
full 64K RAM, while the C16 does not use banking and supports up to 32K RAM.
@ -95,7 +95,7 @@ There are currently no special Plus/4 functions.
<sect1>CBM specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
<itemize>
@ -232,7 +232,7 @@ The runtime for the Plus/4 uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -2,7 +2,7 @@
<article>
<title>sp65 Users Guide
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
<author><url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">
<date>2012-03-11
<abstract>

View file

@ -3,8 +3,8 @@
<article>
<title>Watara Supervision specific information for cc65
<author>Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">
<date>2005-07-17
<author><url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2014-04-12
<abstract>
An overview over the Supervision runtime system as it is implemented for the
@ -23,7 +23,7 @@ with the cc65 C compiler. It describes the memory layout, Supervision specific h
files, available drivers, and any pitfalls specific to that platform.
Please note that Supervision specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more information.
@ -92,7 +92,7 @@ allow access to hardware located in the address space.
No graphics drivers are currently available for the Supervision.
<!--A TGI driver for the standard graphics mode (160&times;160 in 4 colors) is
available, but must be statically linked, because no file I/O is available.
See the documentation for the <htmlurl url="co65.html" name="co65 utility">
See the documentation for the <url url="co65.html" name="co65 utility">
for information on how to do that.-->
<sect1>Extended memory drivers<p>
@ -105,7 +105,7 @@ No extended memory drivers are currently available for the Supervision.
No joystick drivers are currently available for the Supervision.
<!--A joystick driver for the standard buttons is available, but must be
statically linked, because no file I/O is available. See the documentation for
the <htmlurl url="co65.html" name="co65 utility"> for information on how to do
the <url url="co65.html" name="co65 utility"> for information on how to do
that.-->
<sect1>Mouse drivers<p>

View file

@ -3,8 +3,8 @@
<article>
<title>Using GNU Make with cc65
<author>Oliver Schmidt, <htmlurl url="mailto:ol.sc@web.de" name="ol.sc@web.de">
<date>2009-06-26
<author><url url="mailto:ol.sc@web.de" name="Oliver Schmidt">
<date>2014-04-12
<abstract>
How to build your program using the GNU Make utility.
@ -114,10 +114,10 @@ of creating a <tt/CC65_HOME/ environment variable.
<sect1>Understanding the sample Makefile<p>
Most parts of the sample Makefile follow the guidelines in the
<htmlurl url="http://www.gnu.org/software/make/manual/make.html" name="GNU Make Manual">
<url url="http://www.gnu.org/software/make/manual/make.html" name="GNU Make Manual">
that can be searched online for background information. The automatic generation of
dependency however rather works as described by the GNU Make maintainer Paul D. Smith in
<htmlurl url="http://make.paulandlesley.org/autodep.html#advanced" name="Advanced Auto-Dependencies">.
<url url="http://make.paulandlesley.org/autodep.html#advanced" name="&dquot;Advanced Auto-Dependencies&dquot;">.
Fortunately both GCC and cc65 directly support this method in the meantime.
@ -133,8 +133,8 @@ then the sample Makefile may be invoked from the Windows Command Prompt (cmd.exe
by downloading the following programs:
<itemize>
<item>make.exe: <url url="http://gnuwin32.sourceforge.net/packages/make.htm">
<item>rm.exe: <url url="http://gnuwin32.sourceforge.net/packages/coreutils.htm">
<item><url name="make.exe" url="http://gnuwin32.sourceforge.net/packages/make.htm">
<item><url name="rm.exe" url="http://gnuwin32.sourceforge.net/packages/coreutils.htm">
</itemize>
@ -144,9 +144,9 @@ by downloading the following programs:
The very limited resources of the cc65 target machines now and then require
manual optimization of the build process by compiling individual source files
with different compiler options. GNU Make offers
<htmlurl url="http://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html" name="Target-specific Variable Values">
<url url="http://www.gnu.org/software/make/manual/html_node/Target_002dspecific.html" name="Target-specific Variable Values">
perfectly suited for doing so. For example placing the code of the two modules
<tt/foo/ and <tt/bar/ in the segment <tt/FOOBAR/ can be archived with this
<tt/foo/ and <tt/bar/ in the segment <tt/FOOBAR/ can be achieved with this
target-specific variable definition:
<tscreen><verb>

View file

@ -3,9 +3,10 @@
<article>
<title>Commodore VIC20 (aka VC20) specific information for cc65
<author>Ullrich von Bassewitz, <htmlurl url="mailto:uz@cc65.org" name="uz@cc65.org">
Stefan A. Haubenthal, <htmlurl url="mailto:polluks@sdf.lonestar.org" name="polluks@sdf.lonestar.org">
<date>2004-09-13
<author>
<url url="mailto:uz@cc65.org" name="Ullrich von Bassewitz">,<newline>
<url url="mailto:polluks@sdf.lonestar.org" name="Stefan A. Haubenthal">
<date>2014-04-12
<abstract>
An overview over the VIC20 runtime system as it is implemented for the cc65 C
@ -20,11 +21,11 @@ compiler.
<sect>Overview<p>
This file contains an overview of the VIC20 runtime system as it comes with the
cc65 C compiler. It describes the memory layout, VIC20 specific header files,
cc65 C compiler. It describes the memory layout, VIC20-specific header files,
available drivers, and any pitfalls specific to that platform.
Please note that VIC20 specific functions are just mentioned here, they are
described in detail in the separate <htmlurl url="funcref.html" name="function
Please note that VIC20-specific functions are just mentioned here, they are
described in detail in the separate <url url="funcref.html" name="function
reference">. Even functions marked as "platform dependent" may be available on
more than one platform. Please see the function reference for more
information.
@ -63,24 +64,24 @@ Special locations:
<sect>Platform specific header files<p>
<sect>Platform-specific header files<p>
Programs containing VIC20 specific code may use the <tt/vic20.h/ or <tt/cbm.h/
Programs containing VIC20-specific code may use the <tt/vic20.h/ or <tt/cbm.h/
header files. Using the later may be an option when writing code for more than
one CBM platform, since it includes <tt/vic20.h/ and declares several functions
common to all CBM platforms.
<sect1>VIC20 specific functions<p>
<sect1>VIC20-specific functions<p>
There are currently no special VIC20 functions.
<sect1>CBM specific functions<p>
<sect1>CBM-specific functions<p>
Some functions are available for all (or at least most) of the Commodore
machines. See the <htmlurl url="funcref.html" name="function reference"> for
machines. See the <url url="funcref.html" name="function reference"> for
declaration and usage.
<itemize>
@ -151,6 +152,8 @@ No extended memory drivers are currently available for the VIC20.
<sect1>Joystick drivers<p>
The default drivers, <tt/joy_stddrv (joy_static_stddrv)/, point to <tt/vic20-stdjoy.joy (vic20_stdjoy_joy)/.
<descrip>
<tag><tt/vic20-stdjoy.joy (vic20_stdjoy_joy)/</tag>
@ -158,8 +161,7 @@ No extended memory drivers are currently available for the VIC20.
<tag><tt/vic20-ptvjoy.joy (vic20_ptvjoy_joy)/</tag>
Driver for the Protovision 4-player adapter contributed by Groepaz. See
<htmlurl url="http://www.protovision-online.de/hardw/hardwstart.htm"
name="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
<url url="http://www.protovision-online.de/hardw/hardwstart.htm"> for prices and
building instructions. Up to three joysticks are supported.
</descrip><p>
@ -182,14 +184,16 @@ No VIC1011 drivers are currently available for the VIC20.
<sect>Other hints<p>
<sect1>Escape code<p>
For an Esc press CTRL and [ key.
For an Esc, press CTRL and the <tt/[/ key.
<sect1>Passing arguments to the program<p>
Command line arguments can be passed to <tt/main()/. Since this is not
supported by BASIC, the following syntax was chosen:
Command-line arguments can be passed to <tt/main()/. Since that is not
supported directly by BASIC, the following syntax was chosen:
<tscreen><verb>
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
@ -200,7 +204,7 @@ supported by BASIC, the following syntax was chosen:
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within
a quoted argument are allowed.
<item>The first argument passed to <tt/main/ is the program name.
<item>The first argument passed to <tt/main()/ is the program name.
<item>A maximum number of 10 arguments (including the program name) are
supported.
</enum>
@ -232,7 +236,7 @@ The runtime for the VIC20 uses routines marked as <tt/.INTERRUPTOR/ for
interrupt handlers. Such routines must be written as simple machine language
subroutines and will be called automatically by the interrupt handler code
when they are linked into a program. See the discussion of the <tt/.CONDES/
feature in the <htmlurl url="ca65.html" name="assembler manual">.
feature in the <url url="ca65.html" name="assembler manual">.

View file

@ -275,6 +275,11 @@ unsigned __fastcall__ tgi_ioctl (unsigned char code, void* data);
* for unknown codes or values.
*/
int __fastcall__ tgi_imulround (int rhs, int lhs);
/* Helper function for functions using sine/cosine: Multiply two values, one
* being an 8.8 fixed point one, and return the rounded and scaled result.
*/
/* End of tgi.h */

View file

@ -67,19 +67,6 @@ extern unsigned tgi_charheight; /* Height of scaled bitmap font */
/*****************************************************************************/
/* Code */
/*****************************************************************************/
int __fastcall__ tgi_imulround (int rhs, int lhs);
/* Helper function for functions using sine/cosine: Multiply two values, one
* being an 8.8 fixed point one, and return the rounded and scaled result.
*/
/* End of tgi-kernel.h */
#endif

View file

@ -31,3 +31,7 @@ CA65FLAGS += -D NUMDRVS=4 -D LINEBUF=80 -D UCASE_FILENAME=1 -D DEFAULT_DEVICE=1
# Disabled by default, you should enable it if the linker script relocates the
# character generator (like atarixl-largehimem.cfg).
#CA65FLAGS += -D CHARGEN_RELOC -D USEWSYNC
# Disable if you don't want to use page 6 for mouse P/M data.
# If disabled, top of the RAM is used for P/M data.
CA65FLAGS += -D USE_PAGE6

View file

@ -2,19 +2,14 @@
; Oliver Schmidt, 2013-05-31
;
.export em_libref, joy_libref, tgi_libref, ser_libref, mouse_libref
.export em_libref, joy_libref, tgi_libref
.import _exit
.import atari_ser_libref
em_libref := _exit
joy_libref := _exit
ser_libref := atari_ser_libref
.ifdef __ATARIXL__
.import CIO_handler
tgi_libref := CIO_handler
.import set_VTIMR1_handler
mouse_libref := set_VTIMR1_handler
.else
mouse_libref := _exit
tgi_libref := _exit
.endif

View file

@ -1,126 +1,8 @@
;
; Default mouse callbacks for the Ataris
;
; Christian Groessler, 03.01.2014
;
; derived from Apple2 version by
; Oliver Schmidt, 22.09.2005
;
; All functions in this module should be interrupt safe, because they may
; be called from an interrupt handler
; This file defines the default mouse callback
;
.export _mouse_def_callbacks
.importzp tmp4
.import mul40,loc_tmp
.import _mouse_pm_callbacks
.export _mouse_def_callbacks
.include "atari.inc"
; ------------------------------------------------------------------------
.bss
backup: .res 1
visible:.res 1
; ------------------------------------------------------------------------
.segment "EXTZP" : zeropage
scrptr: .res 2
; ------------------------------------------------------------------------
.rodata
; Callback structure
_mouse_def_callbacks:
.addr hide
.addr show
.addr prep
.addr draw
.addr movex
.addr movey
; ------------------------------------------------------------------------
.data
cursor = 11 ; '+' screen code'
; setcursor
getcursor:
column: ldy #$00 ; Patched at runtime
lda (scrptr),y
rts
setcursor:
column2:ldy #$00 ; Patched at runtime
sta (scrptr),y
rts
; ------------------------------------------------------------------------
.code
done:
rts
; Hide the mouse cursor.
hide:
dec visible
prep:
jsr getcursor ; Get character at cursor position
cmp #cursor ; "mouse" character
bne overwr ; no, probably program has overwritten it
lda backup ;
jmp setcursor ; Draw character
overwr: sta backup
rts
; Show the mouse cursor.
show:
inc visible
draw:
lda visible
beq done
jsr getcursor ; Cursor visible at current position?
sta backup ; Save character at cursor position
lda #cursor
jmp setcursor ; Draw cursor
; Move the mouse cursor x position to the value in A/X.
movex:
cpx #1
ror a
lsr a ; convert to character position
lsr a
sta column+1
sta column2+1
rts
; Move the mouse cursor y position to the value in A/X.
movey:
tax
ldy tmp4 ; mul40 uses tmp4
lda loc_tmp ; and this local variable
pha
txa ; get parameter back
lsr a ; convert y position to character line
lsr a
lsr a
jsr mul40
clc
adc SAVMSC
sta scrptr
txa
adc SAVMSC+1
sta scrptr+1
pla
sta loc_tmp
sty tmp4
rts
_mouse_def_callbacks := _mouse_pm_callbacks

View file

@ -0,0 +1,31 @@
;
; P/M mouse shape default definition
;
; Christian Groessler, 11.04.2014
;
; Note that the height of the mouse cursor must not exceed 32
; lines, otherwise the display routines won't do The Right
; Thing(tm).
;
.export mouse_pm_bits
.export mouse_pm_height : zeropage
.export mouse_pm_hotspot_x : zeropage
.export mouse_pm_hotspot_y : zeropage
.rodata
mouse_pm_bits:
.byte %11110000
.byte %11000000
.byte %10100000
.byte %10010000
.byte %10001000
.byte %00000100
.byte %00000010
mouse_pm_height = * - mouse_pm_bits
; hot spot is upper left corner
mouse_pm_hotspot_x = 0
mouse_pm_hotspot_y = 0

237
libsrc/atari/mcbpm.s Normal file
View file

@ -0,0 +1,237 @@
;
; P/M mouse callbacks for the Ataris
;
; Christian Groessler, 11.04.2014
;
; All functions in this module should be interrupt safe, because they may
; be called from an interrupt handler
;
.include "atari.inc"
.importzp sp
.export _mouse_pm_callbacks
.constructor pm_init,27
.destructor pm_down,7
; get mouse shape data
.import mouse_pm_bits
.importzp mouse_pm_height
.importzp mouse_pm_hotspot_x
.importzp mouse_pm_hotspot_y
; P/M definitions. The MOUSE_PM_NUM value can be changed to adjust the
; number of the P/M used for the mouse. All others depend on this value.
; Valid P/M numbers are 0 to 4. When 4 is used, the missiles are used
; as a player.
.ifdef USE_PAGE6
MOUSE_PM_NUM = 2 ; P/M used for the mouse
; This cannot be changed since only player #2 uses the memory at $600.
.else
MOUSE_PM_NUM = 4 ; P/M used for the mouse
; Using player #4 (missiles) wastes the least amount of memory on the
; atari target, since top of memory is typically at $xC20, and the
; missiles use the space at $xB00-$xBFF.
; On the atarixl target this configuration (not using page 6) is not
; really satisfying since the top of memory typically lies beneath
; the ROM and there is flickering visible while the ROM is banked in.
.endif
MOUSE_PM_BASE = pm_base ; ZP location pointing to the hw area used by the selected P/M
.if MOUSE_PM_NUM = 4
MOUSE_PM_RAW = 0 ; MOUSE_PM_RAW is the hardware P/M number for MOUSE_PM_NUM
.macro set_mouse_x
; assume CF = 0
sta HPOSM3
adc #2
sta HPOSM2
adc #2
sta HPOSM1
adc #2
sta HPOSM0
.endmacro
.else
MOUSE_PM_RAW = MOUSE_PM_NUM + 1
.macro set_mouse_x
sta HPOSP0 + MOUSE_PM_NUM
.endmacro
.endif
; ------------------------------------------------------------------------
.rodata
; Callback structure
_mouse_pm_callbacks:
.addr hide
.addr show
.addr prep
.addr draw
.addr movex
.addr movey
; ------------------------------------------------------------------------
.bss
omy: .res 1 ; old Mouse Y position
colhlp: .res 1 ; helper variable to set P/M color
; ------------------------------------------------------------------------
.segment "EXTZP" : zeropage
pm_base:.res 2
; ------------------------------------------------------------------------
.code
; Hide the mouse cursor.
hide: lda #0
sta GRACTL
rts
; Show the mouse cursor.
show:
.if MOUSE_PM_NUM < 4
lda #2
.else
lda #1
.endif
sta GRACTL
jmp update_colors
prep:
draw:
rts
; Move the mouse cursor x position to the value in A/X.
movex: cpx #1
ror a
clc
adc #48
sbc #(mouse_pm_hotspot_x - 1) & $FF
set_mouse_x
jmp update_colors
; Move the mouse cursor y position to the value in A/X.
movey: clc
adc #32
sbc #(mouse_pm_hotspot_y - 1) & $FF
pha
lda omy
jsr clr_pm ; remove player at old position
jsr update_colors
pla
sta omy
;jmp set_pm ; put player to new position
; fall thru
; Set P/M data from 'mouse_pm_bits'
set_pm: tay
ldx #0
set_l: lda mouse_pm_bits,x
sta (MOUSE_PM_BASE),y
inx
iny
beq set_end
cpx #mouse_pm_height
bcc set_l
set_end:rts
; Clear (zero) P/M data
clr_pm: ldx #mouse_pm_height
tay
lda #0
clr_l: sta (MOUSE_PM_BASE),y
iny
beq clr_end
dex
bne clr_l
clr_end:rts
pm_down = hide
; this assumes a GRAPHICS 0 screen
update_colors:
lda COLOR2 ; get background color
and #$F0
sta colhlp
lda COLOR1
and #$0F
ora colhlp
.if MOUSE_PM_NUM = 4
sta PCOLR0
sta PCOLR1
sta PCOLR2
sta PCOLR3
lda #0
sta SIZEM
.else
sta PCOLR0 + MOUSE_PM_NUM
lda #0
sta SIZEP0 + MOUSE_PM_NUM
.endif
rts
; ------------------------------------------------------------------------
.segment "INIT"
pm_init:
lda #0
.ifdef USE_PAGE6
sta MOUSE_PM_BASE
ldx #6 ; page 6
stx MOUSE_PM_BASE+1
.else
; use top of memory and lower sp accordingly
sta sp
sta MOUSE_PM_BASE
lda sp+1
and #7 ; offset within 2K
cmp #3 + MOUSE_PM_RAW + 1 ; can we use it?
bcc @decr ; no
lda sp+1
and #$F8
@set: adc #3 + MOUSE_PM_RAW - 1 ; CF is set, so adding MOUSE_PM_RAW + 3
sta MOUSE_PM_BASE+1
sta sp+1
bne @cont ; jump always
@decr: lda sp+1
and #$F8
sbc #8 - 1 ; CF is clear, subtracts 8
bcs @set ; jump always
@cont: lda #0
.endif
tay
@iniloo:sta (MOUSE_PM_BASE),y
iny
bne @iniloo
.ifndef USE_PAGE6
lda MOUSE_PM_BASE+1
and #$F8
.endif
sta PMBASE
lda #62
sta SDMCTL
lda #1
sta GPRIOR
jmp update_colors

View file

@ -0,0 +1,7 @@
;
; Default text mode mouse cursor character
;
; Christian Groessler, 11.04.2014
;
.export mouse_txt_char : zp = 96 ; 'diamond' screen code

125
libsrc/atari/mcbtxtchar.s Normal file
View file

@ -0,0 +1,125 @@
;
; Text mode character mouse callbacks for the Ataris
;
; Christian Groessler, 03.01.2014
;
; derived from Apple2 version by
; Oliver Schmidt, 22.09.2005
;
; All functions in this module should be interrupt safe, because they may
; be called from an interrupt handler
;
.export _mouse_txt_callbacks
.importzp tmp4
.import mul40,loc_tmp
.importzp mouse_txt_char ; screen code of mouse cursor
.include "atari.inc"
; ------------------------------------------------------------------------
.bss
backup: .res 1
visible:.res 1
; ------------------------------------------------------------------------
.segment "EXTZP" : zeropage
scrptr: .res 2
; ------------------------------------------------------------------------
.rodata
; Callback structure
_mouse_txt_callbacks:
.addr hide
.addr show
.addr prep
.addr draw
.addr movex
.addr movey
; ------------------------------------------------------------------------
.data
; setcursor
getcursor:
column: ldy #$00 ; Patched at runtime
lda (scrptr),y
rts
setcursor:
column2:ldy #$00 ; Patched at runtime
sta (scrptr),y
rts
; ------------------------------------------------------------------------
.code
done:
rts
; Hide the mouse cursor.
hide:
dec visible
prep:
jsr getcursor ; Get character at cursor position
cmp #mouse_txt_char ; "mouse" character
bne overwr ; no, probably program has overwritten it
lda backup ;
jmp setcursor ; Draw character
overwr: sta backup
rts
; Show the mouse cursor.
show:
inc visible
draw:
lda visible
beq done
jsr getcursor ; Cursor visible at current position?
sta backup ; Save character at cursor position
lda #mouse_txt_char
jmp setcursor ; Draw cursor
; Move the mouse cursor x position to the value in A/X.
movex:
cpx #1
ror a
lsr a ; convert to character position
lsr a
sta column+1
sta column2+1
rts
; Move the mouse cursor y position to the value in A/X.
movey:
tax
ldy tmp4 ; mul40 uses tmp4
lda loc_tmp ; and this local variable
pha
txa ; get parameter back
lsr a ; convert y position to character line
lsr a
lsr a
jsr mul40
clc
adc SAVMSC
sta scrptr
txa
adc SAVMSC+1
sta scrptr+1
pla
sta loc_tmp
sty tmp4
rts

13
libsrc/atari/mouseref.s Normal file
View file

@ -0,0 +1,13 @@
;
; Christian Groessler, 2014-04-22
;
.export mouse_libref
.ifdef __ATARIXL__
.import set_VTIMR1_handler
mouse_libref := set_VTIMR1_handler
.else
.import _exit
mouse_libref := _exit
.endif

View file

@ -1,7 +1,12 @@
;
; Christian Groessler, 2014-04-22
;
.include "atari.inc"
.include "atari.inc"
.import _close, pushax, popax
.export ser_libref
.import _close, pushax, popax
.import findfreeiocb
.import __do_oserror
.import fddecusage
@ -10,19 +15,19 @@
.import clriocb
.import newfd
.export atari_ser_libref
ser_libref := atari_ser_libref
.rodata
atari_ser_libref:
.word newfd
.word _close
.word pushax
.word popax
.word newfd
.word _close
.word pushax
.word popax
.word findfreeiocb
.word __do_oserror
.word fddecusage
.word fdtoiocb
.word __inviocb
.word clriocb
.word CIOV
.word CIOV

View file

@ -21,7 +21,7 @@
tax
jsr isdisk
bcc open
lda #9 ; "Ilegal device"
lda #9 ; "Illegal device"
rts
; Open channel

View file

@ -48,7 +48,7 @@ __sys_oserrlist:
sys_oserr_entry 6, "File not input"
sys_oserr_entry 7, "File not output"
sys_oserr_entry 8, "Filename missing"
sys_oserr_entry 9, "Ilegal device"
sys_oserr_entry 9, "Illegal device"
sys_oserr_entry 20, "Read error"
sys_oserr_entry 21, "Read error"
sys_oserr_entry 22, "Read error"

View file

@ -40,7 +40,7 @@ ErrTab:
.byte 6, EINVAL ; File not input
.byte 7, EINVAL ; File not output
.byte 8, EINVAL ; Filename missing
.byte 9, ENODEV ; Ilegal device
.byte 9, ENODEV ; Illegal device
; .byte 20, ; Read error
; .byte 21, ; Read error
; .byte 22, ; Read error

View file

@ -74,7 +74,7 @@ init: txa
; Return with error in A
err: lda #9 ; "Ilegal device"
err: lda #9 ; "Illegal device"
done: rts
.endproc
@ -92,4 +92,4 @@ done: rts
@L0: cmp #10
rts
.endproc
.endproc

View file

@ -1,24 +1,156 @@
; mainargs.s
;
; Ullrich von Bassewitz, 2003-03-07
; 2003-03-07, Ullrich von Bassewitz,
; based on code from Stefan A. Haubenthal, <polluks@web.de>
; 2005-02-26, Ullrich von Bassewitz
; 2014-04-02, Greg King
;
; Setup arguments for main
; Scan a group of arguments that are in BASIC's input-buffer.
; Build an array that points to the beginning of each argument.
; Send, to main(), that array and the count of the arguments.
;
; Command-lines look like these lines:
;
; run
; run : rem
; run:rem arg1 " arg 2 is quoted " arg3 "" arg5
;
; "run" and "rem" are entokenned; the args. are not. Leading and trailing
; spaces outside of quotes are ignored.
;
; TO-DO:
; - The "file-name" might be a path-name; don't copy the directory-components.
; - Add a control-character quoting mechanism.
.constructor initmainargs, 24
.import __argc, __argv
.import sys_bank, restore_bank
.import sysp0:zp, ptr1:zp
.include "cbm510.inc"
.macpack generic
;---------------------------------------------------------------------------
MAXARGS = 10 ; Maximum number of arguments allowed
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
; Get possible command-line arguments. Goes into the special INIT segment,
; which may be reused after the startup code is run
; which may be reused after the startup code is run.
;
.segment "INIT"
.proc initmainargs
initmainargs:
; Assume that the program was loaded, a moment ago, by the traditional LOAD
; statement. Save the "most-recent filename" as argument #0.
; Because the buffer, that we're copying into, was zeroed out,
; we don't need to add a NUL character.
;
jsr sys_bank
ldy #FNAM
lda (sysp0),y ; Get file-name pointer from system bank
sta ptr1
iny
lda (sysp0),y
sta ptr1+1
iny ; FNAM_BANK
lda (sysp0),y
tax
ldy #FNAM_LEN
lda (sysp0),y
tay
stx IndReg ; Look for name in correct bank
cpy #NAME_LEN + 1
blt L1
ldy #NAME_LEN - 1 ; limit the length
L0: lda (ptr1),y
sta name,y
L1: dey
bpl L0
jsr restore_bank
inc __argc ; argc always is equal to at least 1
; Find a "rem" token.
;
ldx #0
L2: lda BASIC_BUF,x
bze done ; no "rem," no args.
inx
cmp #REM
bne L2
ldy #1 * 2
; Find the next argument.
;
next: lda BASIC_BUF,x
bze done ; End of line reached
inx
cmp #' ' ; Skip leading spaces
beq next ;
; Found start of next argument. We've incremented the pointer in X already, so
; it points to the second character of the argument. That is useful because we
; will check now for a quoted argument; in which case, we will have to skip that
; first character.
;
found: cmp #'"' ; Is the argument quoted?
beq setterm ; Jump if so
dex ; Reset pointer to first argument character
lda #' ' ; A space ends the argument
setterm:sta term ; Set end-of-argument marker
; Now, store a pointer to the argument into the next slot.
;
txa ; Get low byte
add #<BASIC_BUF
sta argv,y ; argv[y]= &arg
lda #>0
adc #>BASIC_BUF
sta argv+1,y
iny
iny
inc __argc ; Found another arg
; Search for the end of the argument.
;
argloop:lda BASIC_BUF,x
bze done
inx
cmp term
bne argloop
; We've found the end of the argument. X points one character behind it, and
; A contains the terminating character. To make the argument a valid C string,
; replace the terminating character by a zero.
;
lda #0
sta BASIC_BUF-1,x
; Check if the maximum number of command-line arguments is reached. If not,
; parse the next one.
;
lda __argc ; Get low byte of argument count
cmp #MAXARGS ; Maximum number of arguments reached?
blt next ; Parse next one if not
; (The last vector in argv[] already is NULL.)
;
done: lda #<argv
ldx #>argv
sta __argv
stx __argv + 1
rts
.endproc
; These arrays are zeroed before initmainargs is called.
; char name[16+1];
; char* argv[MAXARGS+1]={name};
;
.bss
term: .res 1
name: .res NAME_LEN + 1
.data
argv: .addr name
.res MAXARGS * 2, 0

View file

@ -1,24 +1,156 @@
; mainargs.s
;
; Ullrich von Bassewitz, 2003-03-07
; 2003-03-07, Ullrich von Bassewitz,
; based on code from Stefan A. Haubenthal, <polluks@web.de>
; 2005-02-26, Ullrich von Bassewitz
; 2014-04-02, Greg King
;
; Setup arguments for main
; Scan a group of arguments that are in BASIC's input-buffer.
; Build an array that points to the beginning of each argument.
; Send, to main(), that array and the count of the arguments.
;
; Command-lines look like these lines:
;
; run
; run : rem
; run:rem arg1 " arg 2 is quoted " arg3 "" arg5
;
; "run" and "rem" are entokenned; the args. are not. Leading and trailing
; spaces outside of quotes are ignored.
;
; TO-DO:
; - The "file-name" might be a path-name; don't copy the directory-components.
; - Add a control-character quoting mechanism.
.constructor initmainargs, 24
.import __argc, __argv
.import sys_bank, restore_bank
.import sysp0:zp, ptr1:zp
.include "cbm610.inc"
.macpack generic
;---------------------------------------------------------------------------
MAXARGS = 10 ; Maximum number of arguments allowed
REM = $8f ; BASIC token-code
NAME_LEN = 16 ; maximum length of command-name
; Get possible command-line arguments. Goes into the special INIT segment,
; which may be reused after the startup code is run
; which may be reused after the startup code is run.
;
.segment "INIT"
.proc initmainargs
initmainargs:
; Assume that the program was loaded, a moment ago, by the traditional LOAD
; statement. Save the "most-recent filename" as argument #0.
; Because the buffer, that we're copying into, was zeroed out,
; we don't need to add a NUL character.
;
jsr sys_bank
ldy #FNAM
lda (sysp0),y ; Get file-name pointer from system bank
sta ptr1
iny
lda (sysp0),y
sta ptr1+1
iny ; FNAM_BANK
lda (sysp0),y
tax
ldy #FNAM_LEN
lda (sysp0),y
tay
stx IndReg ; Look for name in correct bank
cpy #NAME_LEN + 1
blt L1
ldy #NAME_LEN - 1 ; limit the length
L0: lda (ptr1),y
sta name,y
L1: dey
bpl L0
jsr restore_bank
inc __argc ; argc always is equal to at least 1
; Find a "rem" token.
;
ldx #0
L2: lda BASIC_BUF,x
bze done ; no "rem," no args.
inx
cmp #REM
bne L2
ldy #1 * 2
; Find the next argument.
;
next: lda BASIC_BUF,x
bze done ; End of line reached
inx
cmp #' ' ; Skip leading spaces
beq next ;
; Found start of next argument. We've incremented the pointer in X already, so
; it points to the second character of the argument. That is useful because we
; will check now for a quoted argument; in which case, we will have to skip that
; first character.
;
found: cmp #'"' ; Is the argument quoted?
beq setterm ; Jump if so
dex ; Reset pointer to first argument character
lda #' ' ; A space ends the argument
setterm:sta term ; Set end-of-argument marker
; Now, store a pointer to the argument into the next slot.
;
txa ; Get low byte
add #<BASIC_BUF
sta argv,y ; argv[y]= &arg
lda #>0
adc #>BASIC_BUF
sta argv+1,y
iny
iny
inc __argc ; Found another arg
; Search for the end of the argument.
;
argloop:lda BASIC_BUF,x
bze done
inx
cmp term
bne argloop
; We've found the end of the argument. X points one character behind it, and
; A contains the terminating character. To make the argument a valid C string,
; replace the terminating character by a zero.
;
lda #0
sta BASIC_BUF-1,x
; Check if the maximum number of command-line arguments is reached. If not,
; parse the next one.
;
lda __argc ; Get low byte of argument count
cmp #MAXARGS ; Maximum number of arguments reached?
blt next ; Parse next one if not
; (The last vector in argv[] already is NULL.)
;
done: lda #<argv
ldx #>argv
sta __argv
stx __argv + 1
rts
.endproc
; These arrays are zeroed before initmainargs is called.
; char name[16+1];
; char* argv[MAXARGS+1]={name};
;
.bss
term: .res 1
name: .res NAME_LEN + 1
.data
argv: .addr name
.res MAXARGS * 2, 0

View file

@ -0,0 +1,23 @@
;
; Oliver Schmidt, 2014-03-27
;
; CC65 library: 8x8 => 16 unsigned multiplication
;
.export _cc65_umul8x8r16
.import umul8x8r16, popa
.include "zeropage.inc"
;---------------------------------------------------------------------------
; 8x8 => 16 unsigned multiplication routine.
.proc _cc65_umul8x8r16
sta ptr1
jsr popa
jmp umul8x8r16
.endproc

View file

@ -43,6 +43,25 @@ endif
# This one comes with VICE
C1541 = c1541
# --------------------------------------------------------------------------
# System dependent settings
# The Apple machines need the start address adjusted when using TGI
LDFLAGS_mandelbrot_apple2 = --start-addr 0x4000
LDFLAGS_tgidemo_apple2 = --start-addr 0x4000
LDFLAGS_mandelbrot_apple2enh = --start-addr 0x4000
LDFLAGS_tgidemo_apple2enh = --start-addr 0x4000
# The Apple ][ needs the start address adjusted for the mousetest
LDFLAGS_mousetest_apple2 = --start-addr 0x4000
# The atarixl target needs the start address adjusted when using TGI
LDFLAGS_mandelbrot_atarixl = --start-addr 0x4000
LDFLAGS_tgidemo_atarixl = --start-addr 0x4000
# The atari target needs to reserve some memory when using TGI
LDFLAGS_mandelbrot_atari = -D __RESERVED_MEMORY__=0x2000
LDFLAGS_tgidemo_atari = -D __RESERVED_MEMORY__=0x2000
# --------------------------------------------------------------------------
# Generic rules
@ -59,9 +78,10 @@ C1541 = c1541
@echo $<
@$(AS) $(AFLAGS) -t $(SYS) $<
.o:
@$(LD) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
.PRECIOUS: %.o
.o:
@$(LD) $(LDFLAGS_$(basename $@)_$(SYS)) -o $@ -t $(SYS) -m $@.map $^ $(CLIB)
# --------------------------------------------------------------------------
# List of executables. This list could be made target dependent by checking
@ -88,62 +108,6 @@ EXELIST = ascii \
.PHONY: all
all: $(EXELIST)
ascii: ascii.o
diodemo: diodemo.o
fire: fire.o
gunzip65: gunzip65.o
hello: hello.o
# The Apple machines need the start address adjusted for the mandelbrot demo
ifeq "$(SYS)" "apple2"
mandelbrot: mandelbrot.o
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
ifeq "$(SYS)" "apple2enh"
mandelbrot: mandelbrot.o
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
mandelbrot: mandelbrot.o
endif
endif
# The Apple ][ needs the start address adjusted for the mousetest
ifeq "$(SYS)" "apple2"
mousetest: mousetest.o
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
mousetest: mousetest.o
endif
multdemo: multidemo.o
@$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
nachtm: nachtm.o
ovrldemo: overlaydemo.o
@$(LD) -o $@ -m $@.map -C $(SYS)-overlay.cfg $^ $(CLIB)
plasma: plasma.o
sieve: sieve.o
# The Apple machines need the start address adjusted for the tgidemo
ifeq "$(SYS)" "apple2"
tgidemo: tgidemo.o
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
ifeq "$(SYS)" "apple2enh"
tgidemo: tgidemo.o
@$(LD) -o $@ -t $(SYS) -m $@.map --start-addr 0x4000 $^ $(CLIB)
else
tgidemo: tgidemo.o
endif
endif
# --------------------------------------------------------------------------
# Rule to make a disk with all samples. Needs the c1541 program that comes
# with the VICE emulator.

View file

@ -5,7 +5,6 @@
#include <ctype.h>
#include <modload.h>
#include <tgi.h>
#include <tgi/tgi-kernel.h>

View file

@ -27,6 +27,17 @@ LD65_LIB = $(datadir)/lib
LD65_OBJ = $(datadir)/lib
LD65_CFG = $(datadir)/cfg
ifdef CMD_EXE
NULLDEV = nul:
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
else
NULLDEV = /dev/null
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
CC = $(CROSS_COMPILE)gcc
AR = $(CROSS_COMPILE)ar
@ -39,13 +50,15 @@ ifdef USER_CFLAGS
$(info USER_CFLAGS: $(USER_CFLAGS))
endif
ifndef GIT_SHA
GIT_SHA := $(if $(wildcard ../.git),$(shell git rev-parse --short HEAD))
ifdef GIT_SHA
$(info GIT_SHA: $(GIT_SHA))
else
GIT_SHA := $(shell git rev-parse --short HEAD 2>$(NULLDEV))
ifneq ($(words $(GIT_SHA)),1)
GIT_SHA := N/A
$(info GIT_SHA: N/A)
endif
endif
$(info GIT_SHA: $(GIT_SHA))
CFLAGS += -MMD -MP -O -I common \
-Wall -Wextra -Wno-char-subscripts $(USER_CFLAGS) \
@ -62,15 +75,6 @@ ifdef CROSS_COMPILE
EXE_SUFFIX=.exe
endif
ifdef CMD_EXE
DIRLIST = $(strip $(foreach dir,$1,$(wildcard $(dir))))
MKDIR = mkdir $(subst /,\,$1)
RMDIR = $(if $(DIRLIST),rmdir /s /q $(subst /,\,$(DIRLIST)))
else
MKDIR = mkdir -p $1
RMDIR = $(RM) -r $1
endif
all bin: $(PROGS)
mostlyclean:

View file

@ -34,7 +34,7 @@
#ifndef SHIFTEXPR_H
#define SHIFTEXPT_H
#define SHIFTEXPR_H

View file

@ -870,8 +870,8 @@ static char GetAddrSizeCode (unsigned char AddrSize)
void PrintExportMap (FILE* F)
/* Print an export map to the given file */
void PrintExportMapByName (FILE* F)
/* Print an export map, sorted by symbol name, to the given file */
{
unsigned I;
unsigned Count;
@ -902,6 +902,61 @@ void PrintExportMap (FILE* F)
static int CmpExpValue (const void* I1, const void* I2)
/* Compare function for qsort */
{
long V1 = GetExportVal (ExpPool [*(unsigned *)I1]);
long V2 = GetExportVal (ExpPool [*(unsigned *)I2]);
return V1 < V2 ? -1 : V1 == V2 ? 0 : 1;
}
void PrintExportMapByValue (FILE* F)
/* Print an export map, sorted by symbol value, to the given file */
{
unsigned I;
unsigned Count;
unsigned *ExpValXlat;
/* Create a translation table where the symbols are sorted by value. */
ExpValXlat = xmalloc (ExpCount * sizeof (unsigned));
for (I = 0; I < ExpCount; ++I) {
/* Initialize table with current sort order. */
ExpValXlat [I] = I;
}
/* Sort them by value */
qsort (ExpValXlat, ExpCount, sizeof (unsigned), CmpExpValue);
/* Print all exports */
Count = 0;
for (I = 0; I < ExpCount; ++I) {
const Export* E = ExpPool [ExpValXlat [I]];
/* Print unreferenced symbols only if explictly requested */
if (VerboseMap || E->ImpCount > 0 || SYM_IS_CONDES (E->Type)) {
fprintf (F,
"%-25s %06lX %c%c%c%c ",
GetString (E->Name),
GetExportVal (E),
E->ImpCount? 'R' : ' ',
SYM_IS_LABEL (E->Type)? 'L' : 'E',
GetAddrSizeCode ((unsigned char) E->AddrSize),
SYM_IS_CONDES (E->Type)? 'I' : ' ');
if (++Count == 2) {
Count = 0;
fprintf (F, "\n");
}
}
}
fprintf (F, "\n");
xfree (ExpValXlat);
}
void PrintImportMap (FILE* F)
/* Print an import map to the given file */
{

View file

@ -186,8 +186,11 @@ void CheckUnresolvedImports (ExpCheckFunc F, void* Data);
* called (see the comments on ExpCheckFunc in the data section).
*/
void PrintExportMap (FILE* F);
/* Print an export map to the given file */
void PrintExportMapByName (FILE* F);
/* Print an export map to the given file (sorted by symbol name) */
void PrintExportMapByValue (FILE* F);
/* Print an export map to the given file (sorted by export value) */
void PrintImportMap (FILE* F);
/* Print an import map to the given file */

View file

@ -80,6 +80,24 @@
static unsigned ObjFiles = 0; /* Count of object files linked */
static unsigned LibFiles = 0; /* Count of library files linked */
/* struct InputFile.Type definitions */
#define INPUT_FILES_FILE 0 /* Entry is a file (unknown type) */
#define INPUT_FILES_FILE_OBJ 1 /* Entry is a object file */
#define INPUT_FILES_FILE_LIB 2 /* Entry is a library file */
#define INPUT_FILES_SGROUP 3 /* Entry is 'StartGroup' */
#define INPUT_FILES_EGROUP 4 /* Entry is 'EndGroup' */
#define MAX_INPUTFILES 256
/* Array of inputs (libraries and object files) */
static struct InputFile {
const char *FileName;
unsigned Type;
} *InputFiles;
static unsigned InputFilesCount = 0;
static const char *CmdlineCfgFile = NULL,
*CmdlineTarget = NULL;
/*****************************************************************************/
@ -390,7 +408,10 @@ static void OptHelp (const char* Opt attribute ((unused)),
static void OptLib (const char* Opt attribute ((unused)), const char* Arg)
/* Link a library */
{
LinkFile (Arg, FILETYPE_LIB);
InputFiles[InputFilesCount].Type = INPUT_FILES_FILE_LIB;
InputFiles[InputFilesCount].FileName = Arg;
if (++InputFilesCount >= MAX_INPUTFILES)
Error ("Too many input files");
}
@ -406,6 +427,9 @@ static void OptLibPath (const char* Opt attribute ((unused)), const char* Arg)
static void OptMapFile (const char* Opt attribute ((unused)), const char* Arg)
/* Give the name of the map file */
{
if (MapFileName) {
Error ("Cannot use -m twice");
}
MapFileName = Arg;
}
@ -426,7 +450,10 @@ static void OptModuleId (const char* Opt, const char* Arg)
static void OptObj (const char* Opt attribute ((unused)), const char* Arg)
/* Link an object file */
{
LinkFile (Arg, FILETYPE_OBJ);
InputFiles[InputFilesCount].Type = INPUT_FILES_FILE_OBJ;
InputFiles[InputFilesCount].FileName = Arg;
if (++InputFilesCount >= MAX_INPUTFILES)
Error ("Too many input files");
}
@ -439,16 +466,14 @@ static void OptObjPath (const char* Opt attribute ((unused)), const char* Arg)
static void OptOutputName (const char* Opt, const char* Arg)
static void OptOutputName (const char* Opt attribute ((unused)), const char* Arg)
/* Give the name of the output file */
{
/* If the name of the output file has been used in the config before
* (by using %O) we're actually changing it later, which - in most cases -
* gives unexpected results, so emit a warning in this case.
*/
if (OutputNameUsed) {
Warning ("Option `%s' should precede options `-t' or `-C'", Opt);
static int OutputNameSeen = 0;
if (OutputNameSeen) {
Error ("Cannot use -o twice");
}
OutputNameSeen = 1;
OutputName = Arg;
}
@ -457,6 +482,9 @@ static void OptOutputName (const char* Opt, const char* Arg)
static void OptStartAddr (const char* Opt, const char* Arg)
/* Set the default start address */
{
if (HaveStartAddr) {
Error ("Cannot use -S twice");
}
StartAddr = CvtNumber (Opt, Arg);
HaveStartAddr = 1;
}
@ -520,16 +548,61 @@ static void OptVersion (const char* Opt attribute ((unused)),
int main (int argc, char* argv [])
/* Assembler main program */
static void CmdlOptStartGroup (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Remember 'start group' occurrence in input files array */
{
InputFiles[InputFilesCount].Type = INPUT_FILES_SGROUP;
InputFiles[InputFilesCount].FileName = Arg; /* Unused */
if (++InputFilesCount >= MAX_INPUTFILES)
Error ("Too many input files");
}
static void CmdlOptEndGroup (const char* Opt attribute ((unused)),
const char* Arg attribute ((unused)))
/* Remember 'end group' occurrence in input files array */
{
InputFiles[InputFilesCount].Type = INPUT_FILES_EGROUP;
InputFiles[InputFilesCount].FileName = Arg; /* Unused */
if (++InputFilesCount >= MAX_INPUTFILES)
Error ("Too many input files");
}
static void CmdlOptConfig (const char* Opt attribute ((unused)), const char* Arg)
/* Set 'config file' command line parameter */
{
if (CmdlineCfgFile || CmdlineTarget) {
Error ("Cannot use -C/-t twice");
}
CmdlineCfgFile = Arg;
}
static void CmdlOptTarget (const char* Opt attribute ((unused)), const char* Arg)
/* Set 'target' command line parameter */
{
if (CmdlineCfgFile || CmdlineTarget) {
Error ("Cannot use -C/-t twice");
}
CmdlineTarget = Arg;
}
static void ParseCommandLine(void)
{
/* Program long options */
static const LongOpt OptTab[] = {
{ "--cfg-path", 1, OptCfgPath },
{ "--config", 1, OptConfig },
{ "--config", 1, CmdlOptConfig },
{ "--dbgfile", 1, OptDbgFile },
{ "--define", 1, OptDefine },
{ "--end-group", 0, OptEndGroup },
{ "--end-group", 0, CmdlOptEndGroup },
{ "--force-import", 1, OptForceImport },
{ "--help", 0, OptHelp },
{ "--lib", 1, OptLib },
@ -539,27 +612,18 @@ int main (int argc, char* argv [])
{ "--obj", 1, OptObj },
{ "--obj-path", 1, OptObjPath },
{ "--start-addr", 1, OptStartAddr },
{ "--start-group", 0, OptStartGroup },
{ "--target", 1, OptTarget },
{ "--start-group", 0, CmdlOptStartGroup },
{ "--target", 1, CmdlOptTarget },
{ "--version", 0, OptVersion },
};
unsigned I;
unsigned MemoryAreaOverflows;
unsigned LabelFileGiven = 0;
/* Initialize the cmdline module */
InitCmdLine (&argc, &argv, "ld65");
/* Allocate memory for input file array */
InputFiles = xmalloc (MAX_INPUTFILES * sizeof (struct InputFile));
/* Initialize the input file search paths */
InitSearchPaths ();
/* Initialize the string pool */
InitStrPool ();
/* Initialize the type pool */
InitTypePool ();
/* Check the parameters */
/* Defer setting of config/target and input files until all options are parsed */
I = 1;
while (I < ArgCount) {
@ -577,11 +641,11 @@ int main (int argc, char* argv [])
break;
case '(':
OptStartGroup (Arg, 0);
CmdlOptStartGroup (Arg, 0);
break;
case ')':
OptEndGroup (Arg, 0);
CmdlOptEndGroup (Arg, 0);
break;
case 'h':
@ -594,14 +658,11 @@ int main (int argc, char* argv [])
break;
case 'o':
OptOutputName (Arg, GetArg (&I, 2));
OptOutputName (NULL, GetArg (&I, 2));
break;
case 't':
if (CfgAvail ()) {
Error ("Cannot use -C/-t twice");
}
OptTarget (Arg, GetArg (&I, 2));
CmdlOptTarget (Arg, GetArg (&I, 2));
break;
case 'u':
@ -617,7 +678,7 @@ int main (int argc, char* argv [])
break;
case 'C':
OptConfig (Arg, GetArg (&I, 2));
CmdlOptConfig (Arg, GetArg (&I, 2));
break;
case 'D':
@ -626,9 +687,17 @@ int main (int argc, char* argv [])
case 'L':
switch (Arg [2]) {
/* ## The first one is obsolete and will go */
case 'n': LabelFileName = GetArg (&I, 3); break;
default: OptLibPath (Arg, GetArg (&I, 2)); break;
case 'n':
/* ## This one is obsolete and will go */
if (LabelFileGiven) {
Error ("Cannot use -Ln twice");
}
LabelFileGiven = 1;
LabelFileName = GetArg (&I, 3);
break;
default:
OptLibPath (Arg, GetArg (&I, 2));
break;
}
break;
@ -648,7 +717,10 @@ int main (int argc, char* argv [])
} else {
/* A filename */
LinkFile (Arg, FILETYPE_UNKNOWN);
InputFiles[InputFilesCount].Type = INPUT_FILES_FILE;
InputFiles[InputFilesCount].FileName = Arg;
if (++InputFilesCount >= MAX_INPUTFILES)
Error ("Too many input files");
}
@ -656,6 +728,61 @@ int main (int argc, char* argv [])
++I;
}
if (CmdlineTarget) {
OptTarget (NULL, CmdlineTarget);
} else if (CmdlineCfgFile) {
OptConfig (NULL, CmdlineCfgFile);
}
/* Process input files */
for (I = 0; I < InputFilesCount; ++I) {
switch (InputFiles[I].Type) {
case INPUT_FILES_FILE:
LinkFile (InputFiles[I].FileName, FILETYPE_UNKNOWN);
break;
case INPUT_FILES_FILE_LIB:
LinkFile (InputFiles[I].FileName, FILETYPE_LIB);
break;
case INPUT_FILES_FILE_OBJ:
LinkFile (InputFiles[I].FileName, FILETYPE_OBJ);
break;
case INPUT_FILES_SGROUP:
OptStartGroup (NULL, 0);
break;
case INPUT_FILES_EGROUP:
OptEndGroup (NULL, 0);
break;
default:
abort ();
}
}
/* Free memory used for input file array */
xfree (InputFiles);
}
int main (int argc, char* argv [])
/* Linker main program */
{
unsigned MemoryAreaOverflows;
/* Initialize the cmdline module */
InitCmdLine (&argc, &argv, "ld65");
/* Initialize the input file search paths */
InitSearchPaths ();
/* Initialize the string pool */
InitStrPool ();
/* Initialize the type pool */
InitTypePool ();
/* Parse the command line */
ParseCommandLine ();
/* Check if we had any object files */
if (ObjFiles == 0) {
Error ("No object files to link");

View file

@ -111,11 +111,17 @@ void CreateMapFile (int ShortMap)
/* The remainder is not written for short map files */
if (!ShortMap) {
/* Write the exports list */
/* Write the exports list by name */
fprintf (F, "\n\n"
"Exports list:\n"
"-------------\n");
PrintExportMap (F);
"Exports list by name:\n"
"---------------------\n");
PrintExportMapByName (F);
/* Write the exports list by value */
fprintf (F, "\n\n"
"Exports list by value:\n"
"----------------------\n");
PrintExportMapByValue (F);
/* Write the imports list */
fprintf (F, "\n\n"

View file

@ -1,5 +1,5 @@
/*
** These programs test CC65's exec() program-chaining function.
** These programs test cc65's exec() program-chaining function.
** exec-test1 runs exec-test2 -- that tests the loading and starting of another
** program. Then, exec-test2 runs arg-test -- that tests command-line argument
** passing.

View file

@ -1,5 +1,5 @@
/*
** These programs test CC65's exec() program-chaining function.
** These programs test cc65's exec() program-chaining function.
** exec-test1 runs exec-test2 -- that tests the loading and starting of another
** program. Then, exec-test2 runs arg-test -- that tests command-line argument
** passing.