]> git.sur5r.net Git - cc65/blobdiff - doc/cbm510.sgml
remote TABs in doc/ and test/
[cc65] / doc / cbm510.sgml
index e705711352d3b9ea9d3ac0ff4268b8627ea642d5..1ec0e05d411a25f5c6397db05a9486f4d684560e 100644 (file)
@@ -1,12 +1,11 @@
 <!doctype linuxdoc system>
 
 <article>
-
-<title>Commodore 510 (aka P500) 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>Commodore 510 (aka P500) 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>2014-03-26
 
 <abstract>
 An overview over the Commodore 510 runtime system as it is implemented for the
@@ -38,10 +37,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 +57,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,10 +65,10 @@ 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;FEC2, 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>
 
@@ -79,7 +78,7 @@ Special locations:
 
 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>
@@ -117,6 +116,8 @@ declaration and usage.
 <item>cbm_k_basin
 <item>cbm_k_bsout
 <item>cbm_k_clrch
+<item>cbm_k_tksa
+<item>cbm_k_second
 <item>cbm_load
 <item>cbm_open
 <item>cbm_opendir
@@ -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
+<em/Note:/ 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>
@@ -241,23 +242,30 @@ The default drivers, <tt/mouse_stddrv (mouse_static_stddrv)/, point to <tt/cbm51
 <sect>Limitations<label id="limitations"><p>
 
 
+<sect1>Realtime clock<p>
+
+The realtime clock functions use the CIA1 TOD clock. As that clock only stores
+the time but not the date, the date set by <tt/clock_settime()/ is simply stored
+inside the C library for retrieval in the same program via <tt/clock_gettime()/.
+
+
 <sect1>Kernal and hardware access<p>
 
 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.
@@ -269,8 +277,22 @@ a program should not do file I/O while it depends on interrupts.
 
 <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>
@@ -300,14 +322,14 @@ including commercial applications, and to alter it and redistribute it
 freely, subject to the following restrictions:
 
 <enum>
-<item> The origin of this software must not be misrepresented; you must not
-       claim that you wrote the original software. If you use this software
-       in a product, an acknowledgment in the product documentation would be
-       appreciated but is not required.
-<item> Altered source versions must be plainly marked as such, and must not
-       be misrepresented as being the original software.
-<item> This notice may not be removed or altered from any source
-       distribution.
+<item>  The origin of this software must not be misrepresented; you must not
+        claim that you wrote the original software. If you use this software
+        in a product, an acknowledgment in the product documentation would be
+        appreciated but is not required.
+<item>  Altered source versions must be plainly marked as such, and must not
+        be misrepresented as being the original software.
+<item>  This notice may not be removed or altered from any source
+        distribution.
 </enum>
 
 </article>