Viitor_cc65/usr/share/doc/cc65/webdoc/intro-6.html
kueller 223cc6685e Neue Version V963
git-svn-id: svn://svn.compuextreme.de/Viitor/V963/Viitor_cc65@5933 504e572c-2e33-0410-9681-be2bf7408885
2011-01-03 10:48:06 +00:00

307 lines
11 KiB
HTML

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">
<HTML>
<HEAD>
<META NAME="GENERATOR" CONTENT="LinuxDoc-Tools 0.9.20">
<TITLE>cc65 Compiler Intro: Running The Executable</TITLE>
<LINK HREF="intro-5.html" REL=previous>
<LINK HREF="intro.html#toc6" REL=contents>
</HEAD>
<BODY>
Next
<A HREF="intro-5.html">Previous</A>
<A HREF="intro.html#toc6">Contents</A>
<HR>
<H2><A NAME="s6">6.</A> <A HREF="intro.html#toc6">Running The Executable</A></H2>
<P><EM>Note: this section is incomplete!</EM></P>
<P>Depending on the target, cc65 chooses several methods of making a
program available for execution. Here, we list sample emulators and
instructions for running the program. Unless noted, similar instructions
would also apply to a real machine. One word of advice: we suggest you clear
the screen at the start, and wait for a keypress at the end of your program,
as each target varies in it's start and exit conditions.</P>
<H2><A NAME="ss6.1">6.1</A> <A HREF="intro.html#toc6.1">Apple</A>
</H2>
<H3>AppleWin 1.10.4</H3>
<P>Available at
<A HREF="http://www.jantzer-schmidt.de/applewin/">http://www.jantzer-schmidt.de/applewin/</A>:</P>
<P>Emulates Apple II+/IIe computers, with sound, video, joysticks, serial port,
and disk images. Includes monitor. Only for Windows. The package comes with
ROM and DOS 3.3 disk (called "master.dsk") images; however, you will need
<B>a2tools</B> (available at
<A HREF="http://hotel04.ausys.se/pausch/apple2/#a2tools">http://hotel04.ausys.se/pausch/apple2/#a2tools</A>).</P>
<P>Compile the tutorial with</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
cl65 -O -t apple2 hello.c text.s
</PRE>
</CODE></BLOCKQUOTE>
for the Apple II, or:
<BLOCKQUOTE><CODE>
<PRE>
cl65 -O -t apple2enh hello.c text.s
</PRE>
</CODE></BLOCKQUOTE>
for the Apple IIe.</P>
<P>Then, insert the file into an Apple disk image, for use with an emulator. Copy
the <CODE>master.dsk</CODE> which comes with <B>Applewin</B>, and rename it to
<CODE>cc65.dsk</CODE>, then use <B>a2tools</B>:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
a2tools in -r b cc65.dsk TEST hello
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Note that a convention in the Apple world is that "hello" is the file which is
run automatically upon booting a DOS disk, sort of like the "autoexec.bat" of
the MSDOS/Windows world. We've avoided that in the example, however. Also,
the <CODE>TEST</CODE> parameter must be in caps., and is the name of the program as it
will appear on the Apple disk.</P>
<P>Start the emulator, click on the <B>Disk 1</B> icon, and point to <B>cc65.dsk</B>;
then, click the big Apple logo, to boot the system. Then, type this on the
Apple:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
BRUN TEST
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>You will see the "Hello, World!" appear on the same line. Thanks to Oliver
Schmidt,
<A HREF="mailto:oliver@jantzer-schmidt.de">oliver@jantzer-schmidt.de</A> for his help in completing this section.</P>
<H2><A NAME="ss6.2">6.2</A> <A HREF="intro.html#toc6.2">Atari</A>
</H2>
<H3>Atari800Win Plus 3.0</H3>
<P>Available at
<A HREF="http://www.a800win.atari-area.prv.pl">http://www.a800win.atari-area.prv.pl</A>:</P>
<P>Emulates Atari 400/800/65XE/130XE/800XL/1200XL/5200, with stereo sound, disk
images, scanline-exact NTSC/PAL video, joysticks, mouse, cartridges, and RAM
expansions. Includes monitor. Unfortunately, only for Windows. You will need
the emulator, "atarixl.rom" or "atariosb.rom"/"ataribas.rom", and "dos25.xfd"
files (not supplied).</P>
<P>Compile the tutorial with</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
cl65 -O -t atari hello.c text.s
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>Start the emulator, choose <B>File&gt;Autoboot image</B> or <B>File&gt;Load
executable</B>, and point to the "<B>hello</B>" executable. It is customary to
rename executables of that type to "<B>hello.xex</B>". The file has a 7-byte
header meant to be loaded directly from Atari DOS 2/2.5 or compatibles.</P>
<P>On a real Atari, you would need a disk drive, and Atari DOS 2.5 or compatible.
Turn on the computer, type</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
DOS
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>at the BASIC prompt, then choose <B>N. CREATE MEM.SAV</B>,
then choose <B>L. BINARY LOAD</B>, and enter <CODE>HELLO</CODE>.</P>
<P>The emulation, also, supports that method. Look at <B>Atari&gt;Settings</B>, and
check <B>Enable H: Patch for Hard Disk Devices</B>, then <B>Atari&gt;Hard
disks</B>, and set the path of <B>H1:</B> to your executables directory, then use
"<B>H0:HELLO.XEX</B>" in the above procedure (after pressing <CODE>L</CODE>), to access
your harddrive directly.</P>
<P><B>Note</B>: There is no delay after the program exits, as you are returned
to the DOS menu. Your C program should wait for a keypress if you want to see
any output.</P>
<H2><A NAME="ss6.3">6.3</A> <A HREF="intro.html#toc6.3">Commodore</A>
</H2>
<H3>VICE 1.16</H3>
<P>Available at
<A HREF="http://www.zimmers.net/anonftp/pub/cbm/crossplatform/emulators/VICE/">http://www.zimmers.net/anonftp/pub/cbm/crossplatform/emulators/VICE/</A>,<BR>
and at
<A HREF="http://www.ibiblio.org/pub/micro/commodore/crossplatform/emulators/VICE/">http://www.ibiblio.org/pub/micro/commodore/crossplatform/emulators/VICE/</A>:</P>
<P>Emulates Commodore 64/128/VIC-20/PET/CBM II/Plus 4 computers. Supports
printers, serial port and adapters, stereo sound, disk drives and images, RAM
expansions, cartridges, ethernet connection, cycle-exact NTSC/PAL video, mice,
and joysticks. Includes monitor. Runs on MSDOS/PCDOS, Win9x/ME/NT/2000/XP, OS2,
BeOS x86, Acorn RISC OS, and most Unixes.</P>
<P>Compile the tutorial with
<BLOCKQUOTE><CODE>
<PRE>
cl65 -O -t &lt;sys&gt; hello.c text.s
</PRE>
</CODE></BLOCKQUOTE>
Substitute the name of a Commodore computer for that <CODE>&lt;sys&gt;</CODE>:
<UL>
<LI><CODE>c128</CODE></LI>
<LI><CODE>c16</CODE></LI>
<LI><CODE>c64</CODE></LI>
<LI><CODE>cbm510</CODE></LI>
<LI><CODE>cbm610</CODE></LI>
<LI><CODE>pet</CODE></LI>
<LI><CODE>plus4</CODE></LI>
<LI><CODE>vic20</CODE></LI>
</UL>
</P>
<P>Start the desired version of the emulator (CBM510 and CBM610 programs run on
the CBM II [<CODE>xcbm2</CODE>] emulator).</P>
<P>In the Windows versions of VICE, choose <B>File&gt;Autoboot disk/tape
image...</B>, choose your executable, and click <B>OK</B>.</P>
<P>In the Unix versions, hold down the mouse's first button. Move the pointer to
<B>Smart-attach disk/tape...</B>, and release the button. Choose your
executable, and click <B>Autostart</B>.</P>
<P>The file has a 14-byte header which corresponds to a PRG-format BASIC program,
consisting of a single line, similar to this:</P>
<P>
<BLOCKQUOTE><CODE>
<HR>
<PRE>
1000 sys2061
</PRE>
<HR>
</CODE></BLOCKQUOTE>
</P>
<P>On a real Commodore with attached disk drive, you would type:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
LOAD "0:HELLO",8
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>for VIC-20/C64, or:</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
DLOAD "HELLO"
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>on PET/CBM II/C128/C16/Plus 4; then, type</P>
<P>
<BLOCKQUOTE><CODE>
<PRE>
RUN
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>On a Commodore 128, you can combine those two commands:
<BLOCKQUOTE><CODE>
<PRE>
RUN "HELLO"
</PRE>
</CODE></BLOCKQUOTE>
</P>
<P>The output will appear on a separate line, and you will be returned to a BASIC
prompt.</P>
<H2><A NAME="ss6.4">6.4</A> <A HREF="intro.html#toc6.4">GEOS</A>
</H2>
<P>Available at <I>Click Here Software's</I>
<A HREF="http://cmdrkey.com/cbm/geos/geos1.html">GEOS download page</A>:</P>
<P><I><B>G</B>raphics <B>E</B>nvironment <B>O</B>perating <B>S</B>ystem.</I>
It provides a WIMP GUI (Windows, Icons, and Mouse-Pointer Graphical User
Interface) for Commodore's computer models <B>64</B> and <B>128</B>. It can be
controlled by many different types of input devices:
<UL>
<LI>keyboard</LI>
<LI>joysticks</LI>
<LI>mice</LI>
<LI>trackballs</LI>
<LI>graphics drawing tablets</LI>
<LI>light-pens</LI>
</UL>
</P>
<P>The tutorial files are different for GEOS. You will find them "next door," in
"<CODE>cc65/samples/geos</CODE>"; they are called "<CODE>hello1.c</CODE>" and
"<CODE>apphello1.grc</CODE>".</P>
<P>Compile the tutorial with
<BLOCKQUOTE><CODE>
<PRE>
cl65 -O -t geos hello1.c apphello1.grc
</PRE>
</CODE></BLOCKQUOTE>
Copy the resulting file "<CODE>hello1</CODE>" onto a (GEOS-format) disk.</P>
<P>Boot the GEOS master disk/image.</P>
<P>
<BLOCKQUOTE>
When you want to run GEOS in an emulator, you must adjust that emulator so that
it does a "true drive" emulation. Each emulator has its own way of turning that
feature on.
</BLOCKQUOTE>
</P>
<P>
<BLOCKQUOTE>
VICE even has different ways that depend on which operating system is running
the emulator.
<UL>
<LI>In Windows, you must click on <B>Options</B> (in an always visible menu).
Then, you must click on <B>True drive emulation</B>.</LI>
<LI>In Unix, you must <EM>hold down</EM> the second button on your mouse. Move
the pointer down to <B>Drive settings</B>. Then, move the pointer over to
<B>Enable true drive emulation</B>. (If there is a check-mark in front of
those words, that feature already is turned on -- then, move the pointer
off of that menu.) Release the mouse button.</LI>
</UL>
</BLOCKQUOTE>
</P>
<P>Find the <B>CONVERT</B> program on the boot disk [tap the 6-key; then, you
should see it's icon in the fourth position on the <B>deskTop</B>'s directory
notePad]. Move GEOS's pointer over to <B>CONVERT</B>'s icon; double-click
it to run that program. Click on the <B>Disk</B> icon; put the disk with
"<CODE>hello1</CODE>" into the drive; and, click the <B>OK</B> icon. Use the little
icons under the list of file-names to move through that list until you find
"<CODE>hello1</CODE>". Click on it; and then, click on the <B>Convrt</B> icon.
<B>CONVERT</B> will ask you to confirm that you choose the correct file; click
<B>YES</B> if you did (or, click <B>NO</B> if you made a mistake). After the
program has converted "<CODE>hello1</CODE>" from a CBM file into a GEOS file, it will
announce what it did -- click on <B>OK</B>. <B>CONVERT</B> will show the file list
again. This time, click on <B>Quit</B>.</P>
<P>(You might need to put the boot disk back into the drive, in order to reload
<B>deskTop</B>. Then, you must swap back to the disk with the tutorial program
on it, and click on its disk icon [on the right side of the screen].)</P>
<P>Now, you must find <B>hello1</B>. Click on the lower left-hand corner of the
directory notePad. Look at the eight file-positions on each page until you see
<B>hello1</B>. Double-click on its icon.</P>
<P>The output is shown in a GEOS dialog box; click <B>OK</B> when you have finished
reading it.</P>
<H2><A NAME="ss6.5">6.5</A> <A HREF="intro.html#toc6.5">Contributions wanted</A>
</H2>
<P>We need your help! Recommended emulators and instructions for other targets
are missing. We suggest that you choose emulators with good compatibility.
Also, being able to run all computers in the target series is good for
target compatibility testing. A machine-language monitor is almost essential
for debugging, but a native debugger could be used, as well.</P>
<P>Finally, emulators which run on Unix or Windows would help to reach a wider
audience.</P>
<HR>
Next
<A HREF="intro-5.html">Previous</A>
<A HREF="intro.html#toc6">Contents</A>
</BODY>
</HTML>