78 lines
1.9 KiB
HTML
78 lines
1.9 KiB
HTML
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
|
||
|
<HTML>
|
||
|
<HEAD>
|
||
|
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
|
||
|
<TITLE>Commodore PET specific information for cc65: Other hints</TITLE>
|
||
|
<LINK HREF="pet-8.html" REL=next>
|
||
|
<LINK HREF="pet-6.html" REL=previous>
|
||
|
<LINK HREF="pet.html#toc7" REL=contents>
|
||
|
</HEAD>
|
||
|
<BODY>
|
||
|
<A HREF="pet-8.html">Next</A>
|
||
|
<A HREF="pet-6.html">Previous</A>
|
||
|
<A HREF="pet.html#toc7">Contents</A>
|
||
|
<HR>
|
||
|
<H2><A NAME="s7">7.</A> <A HREF="pet.html#toc7">Other hints</A></H2>
|
||
|
|
||
|
|
||
|
|
||
|
<H2><A NAME="ss7.1">7.1</A> <A HREF="pet.html#toc7.1">Passing arguments to the program</A>
|
||
|
</H2>
|
||
|
|
||
|
|
||
|
<P>Command line arguments can be passed to <CODE>main()</CODE>. Since this is not
|
||
|
supported by BASIC, the following syntax was chosen:</P>
|
||
|
<P>
|
||
|
<BLOCKQUOTE><CODE>
|
||
|
<PRE>
|
||
|
RUN:REM ARG1 " ARG2 IS QUOTED" ARG3 "" ARG5
|
||
|
</PRE>
|
||
|
</CODE></BLOCKQUOTE>
|
||
|
</P>
|
||
|
<P>
|
||
|
<OL>
|
||
|
<LI>Arguments are separated by spaces.</LI>
|
||
|
<LI>Arguments may be quoted.</LI>
|
||
|
<LI>Leading and trailing spaces around an argument are ignored. Spaces within
|
||
|
a quoted argument are allowed.</LI>
|
||
|
<LI>The first argument passed to <CODE>main</CODE> is the program name.</LI>
|
||
|
<LI>A maximum number of 10 arguments (including the program name) are
|
||
|
supported.</LI>
|
||
|
</OL>
|
||
|
</P>
|
||
|
|
||
|
|
||
|
<H2><A NAME="ss7.2">7.2</A> <A HREF="pet.html#toc7.2">Program return code</A>
|
||
|
</H2>
|
||
|
|
||
|
|
||
|
<P>The program return code (low byte) is passed back to BASIC by use of the
|
||
|
<CODE>ST</CODE> variable.</P>
|
||
|
|
||
|
|
||
|
<H2><A NAME="ss7.3">7.3</A> <A HREF="pet.html#toc7.3">Using extended memory</A>
|
||
|
</H2>
|
||
|
|
||
|
|
||
|
<P>The extended memory at $9000 of the CBM 8x96 may be added to the heap by using
|
||
|
the following code:</P>
|
||
|
<P>
|
||
|
<BLOCKQUOTE><CODE>
|
||
|
<PRE>
|
||
|
/* Check for the existence of RAM */
|
||
|
if (PEEK(0x9000) == POKE(0x9000, PEEK(0x9000)+1)) {
|
||
|
/* Add it to the heap */
|
||
|
_heapadd ((void *) 0x9000, 0x2000);
|
||
|
}
|
||
|
</PRE>
|
||
|
</CODE></BLOCKQUOTE>
|
||
|
</P>
|
||
|
|
||
|
|
||
|
<HR>
|
||
|
<A HREF="pet-8.html">Next</A>
|
||
|
<A HREF="pet-6.html">Previous</A>
|
||
|
<A HREF="pet.html#toc7">Contents</A>
|
||
|
</BODY>
|
||
|
</HTML>
|