The program code and data is located in low memory. The heap is located
between the program code and the stack. The default size for the parameter
-stack is 2K, you may change this by declaring an externally visible variable
-named named _stksize that holds the new stack size:
-
- unsigned _stksize = 4*1024; /* Use 4K stack */
+stack is 2K, you may change this for most platforms in the linker
+configuration.
Note: The size of the stack is only needed if you use the heap, or if you
call the stack checking routine (_stkcheck) from somewhere in your program.
Systems:
--------
-Supported systems at this time are: C64, C128, Plus/4, CBM 600/700, the newer
-PET machines (not 2001), Atari 8bit, and the Apple ][ (thanks to Kevin Ruland,
-who did the port).
+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
has only 28K available (16K machines are detected and the amount of
free memory is reduced to 12K).
+CBM 500:
+ 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
memory available.
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.
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__)