* Changed the way that Atmos programs are started.

- Put a BASIC-language stub at the beginning.
  - Removed the Autostart flag.

  Those changes make it easy to give command-line arguments to a program.

* Made the Atmos configure file accept a special symbol definition on ld65's command line.  We can use "__RAMEND__" to increase the amount of RAM that's available to programs.
This commit is contained in:
Greg King
2014-11-09 06:32:11 -05:00
parent d75f9c2051
commit 09e50d433d
5 changed files with 116 additions and 47 deletions

View File

@@ -7,7 +7,7 @@
<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-27
<date>2014-09-23
<abstract>
An overview over the Atmos runtime system as it is implemented for the cc65 C
@@ -32,27 +32,37 @@ more than one platform. Please see the function reference for more
information.
<sect>Binary format<p>
The standard binary output format generated by the linker for the Atmos target
is a machine language program with a 17 byte tape header including a cc65 tag.
The standard load and autostart address is &dollar;500.
is a machine language program with a one-line BASIC stub that jumps to the
machine-language part through <tt/CALL/. It has a 24-byte tape header.
It means that a file can be loaded as a BASIC program, and started with RUN.
The standard load address is &dollar;501.
<sect>Memory layout<p>
In the standard setup, cc65 generated programs use the memory from
&dollar;500 to &dollar;9800, so nearly 37K of memory (including the stack) is
In the standard setup, cc65-generated programs use the memory from
&dollar;0501 to &dollar;9800; so, nearly 37K of memory (including the stack) is
available. ROM calls are possible without further precautions.
If your program needs more memory, and it won't use TGI graphics, then you can
use the ld65 command-line option, <tt/-D __RAMEND__=$B400/, when building the
program, to "grab" the graphics screen RAM. Then, nearly 44K of memory is
available.
Special locations:
<descrip>
<tag/Stack/
The C runtime stack is located at &dollar;97FF and growing downwards.
The C runtime stack is located at &dollar;97FF (or &dollar;B3FF), 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>
@@ -117,7 +127,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)/.
The default drivers, <tt/tgi_stddrv (tgi_static_stddrv)/,
point to <tt/atmos-240-200-2.tgi (atmos_240_200_2_tgi)/.
<descrip>
@@ -175,13 +186,14 @@ 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 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.
The existing library for the Atmos doesn't implement C file I/O. There are
hacks for the <tt/read()/ and <tt/write()/ routines in place, which will make
functions work that read from <tt/stdin/ and write to <tt/stdout/ and
<tt/stderr/ (such as <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, the limitation means that you cannot use any of the
To be more concrete, that limitation means that you cannot use any of the
following functions (and a few others):
<itemize>
@@ -202,7 +214,13 @@ following functions (and a few others):
<sect1>Function keys<p>
These are defined to be FUNCT + number key.
They are defined to be FUNCT + a number key.
<sect1>Capitals Lock<p>
The "CAPS Lock" mode is turned off while the program is running. The previous
mode (usually turned on) is restored when the program stops.
<sect1>Passing arguments to the program<p>
@@ -211,10 +229,12 @@ 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
RUN:REM arg1 " ARG2 IS QUOTED" ARG3 "" ARG5
</verb></tscreen>
<enum>
<item>You must turn <tt/CAPS/ lock off (tap CTRL-T) when you want to type
lower-case arguments.
<item>Arguments are separated by spaces.
<item>Arguments may be quoted.
<item>Leading and trailing spaces around an argument are ignored. Spaces within