]> git.sur5r.net Git - cc65/blobdiff - doc/internal.txt
Improved cbm_dir routines by Thomas Giesel.
[cc65] / doc / internal.txt
index a5f69b08670e4aa75758873171c1d167560568fe..0dca618ea7bc7e05fb35d61748c705e6285e904c 100644 (file)
@@ -78,7 +78,7 @@ Ex 1:  Function call:  Assuming 'i' declared int and 'c' declared
                lda     _i              ; get 'i', low byte
                ldx     _i+1            ; get 'i', hi byte
                jsr     pushax          ; push it
-               lda     _c              ; get 'c'
+               lda     _c              ; get 'c'
                jsr     pusha           ; push it
                jsr     _baz            ; call the function
                sta     _i              ; store the result
@@ -110,10 +110,19 @@ compiling them into assembler.  Therefore if you have a C function named
 Systems:
 --------
 
-Supported systems at this time are: C64, C128, Plus/4, CBM 500, CBM 600/700, 
-the newer PET machines (not 2001), Atari 8bit, and the Apple ][ (thanks to 
+Supported systems at this time are: C64, C128, Plus/4, CBM 500, CBM 600/700,
+the newer PET machines (not 2001), Atari 8bit, and the Apple ][ (thanks to
 Kevin Ruland, who did the port).
 
+C16:    Works with unexpanded or memory expanded C16 and C116 machines.
+        However, a maximum of 32KB from the total memory is used. The Plus/4
+        target supports up to 64K of memory, but has a small code overhead
+        because of the banking routines involved. Apart from this additional
+        overhead, the Plus/4 target and the C16 target are the same. 16K
+        machines (unexpanded C16) have 12K of memory for C programs available,
+        machines with 32K or more have 28K available. The actual amount of
+        memory is auto detected.
+
 C64:   The program runs in a memory configuration, where only the kernal ROM
        is enabled. The text screen is expected at the usual place ($400), so
                50K of memory are available to the program.
@@ -122,16 +131,14 @@ C128:     The startup code will reprogram the MMU, so that only the kernal ROM
        is enabled. This means, there are 41K of memory available to the
        program.
 
-Plus/4:        Unfortunately, the Plus/4 is not able to disable only part of it's
-       ROM, it's an all or nothing approach. So, on the Plus/4, the program
-               has only 28K available (16K machines are detected and the amount of
-       free memory is reduced to 12K).
+Plus/4:        Works with bank switching so 59K of memory are available to the 
+        program.
 
 CBM 500:
-       The C program runs in bank #0 and has about 61K memory available. The
-       memory available on the CBM5x0 is slightly less than that available
-       on its bigger brothers (CBM 600/700) because the video ram is also
-       placed into bank #0 to allow sprites.
+       The C program runs in bank #0 and has a total of 48K memory available.
+       This is less than what is available on its bigger brothers (CBM
+       600/700) because the character data and video RAM is placed in the
+       execution bank (#0) to allow the use of sprites.
 
 CBM 600/700:
        The C program runs in a separate segment and has almost full 64K of
@@ -142,26 +149,20 @@ PET:      The startup code will adjust the upper memory limit to the installed
        $8000, so on a 8032 or similar machine, 31K of memory are available to
        the program.
 
-APPLE2:        The program starts at $800, end of RAM is $8E00, so 33.5K of memory
-       (including stack) are available.
+Apple ][:
+        The program starts at $803, end of RAM is $95FF, so 35.5K of memory
+        (including stack) are available to the program.
 
 Atari:  The startup code will adjust the upper memory limit to the installed
-        memory, considering future graphics memory usage (which is allocated
-        at top of RAM). The programmer can specify which graphics mode is
-        about to be used by defining a variable _graphmode_used, unsigned
-        char, to the mode value (mode values like Atari DOS, 0-31).
-       (Please note that graphics mode selection isn't supported in the
-       Atari runtime lib yet!)
-       In the default case the upper memory limit will be $8035 (with Basic
-        cartridge) and $A035 (without cartridge). This is the default which
-        leaves room for the biggest possible graphics mode. If only standard
-        text mode is used (_graphmode_used = 0), the values are $9C1F (with
-        Basic) and $BC1F (no cartridge).
-       The program starts at $1F00 (to leave room for DOS), and the free
-        memory values are $6135 (24K, Basic, default mode), $8135 (32K, no
-        Basic, default mode), $7D1F (31K, Basic, mode 0) and $9D1F (39K,
-        no Basic, mode 0).
-       These values are for a 48K or 64K machine.
+        memory detected at runtime. The programmer can adjust the upper memory
+        limit by setting the __RESERVED_MEMORY__ variable at link time. The
+        given __RESERVED_MEMORY__ value will be subtracted from the upper
+        memory limit used by the runtine. This memory could be used as graphics
+        memory, for example.
+        In the default case (no setting of __RESERVED_MEMORY__) the upper
+        memory limit is $9C1F (with Basic cartridge) and $BC1F (without
+        cartridge). The program starts at $2E00 by default.
+        These values are for a 48K or 64K machine.
 
 Note: The above numbers do not mean that the remaining memory is unusable.
 However, it is not linear memory and must be accessed by other, nonportable
@@ -179,10 +180,7 @@ assembler file.
 
 Example, insert a break instruction into the code:
 
-               asm ("\t.byte\t$00")
-
-Note: The \t in the string is replaced by the tab character, as in all other
-strings.
+               asm ("brk")
 
 Beware: Be careful when inserting inline code since this may collide with
 the work of the optimizer.
@@ -201,7 +199,9 @@ functions results and pass parameters.
 This feature is useful with inline assembly and macros. For example, a macro
 that reads a CRTC register may be written like this:
 
-#define wr(idx) (__AX__=(idx),                                 \
-                       asm("\tsta\t$2000\n\tlda\t$2000\n\tldx\t#$00"), \
+#define wr(idx) (__AX__=(idx),                 \
+                       asm ("sta $2000"),      \
+                asm ("lda $2000"),      \
+                asm ("ldx #$00"),      \
                __AX__)