Next Previous Contents

6. Running The Executable

Note: this section is incomplete!

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.

6.1 Apple


Available at

Emulates Apple ][/enhanced Apple //e computers, with sound, video, joysticks, serial port, and disk images. Includes monitor. Only for Windows. The package comes with a DOS 3.3 disk (called "master.dsk") image; however, you will need AppleCommander 1.3.5 or later (available at

Compile the tutorial with

cl65 -O -t apple2 hello.c text.s
for the Apple ][, or:
cl65 -O -t apple2enh hello.c text.s
for the enhanced Apple //e.

Then, put the file onto an Apple disk image, for use with an emulator. Copy the master.dsk which comes with AppleWin, and rename it to cc65.dsk, then use AppleCommander:

java -jar ac.jar -cc65 cc65.dsk test B < hello

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 B parameter must be in caps., and "test" is the name of the program as it will appear on the Apple disk.

Start the emulator, click on the Disk 1 icon, and point to cc65.dsk; then, click the big Apple logo, to boot the system. Then, type this on the Apple:


You will see the "Hello, World!" appear on the same line. Thanks to Oliver Schmidt, for his help in completing this section.

6.2 Atari

Atari800Win Plus

Available at

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).

Compile the tutorial with

cl65 -O -t atari hello.c text.s

Start the emulator, choose File>Autoboot image or File>Load executable, and point to the "hello" executable. It is customary to rename executables of that type to "hello.xex". The file has a 7-byte header meant to be loaded directly from Atari DOS 2/2.5 or compatibles.

On a real Atari, you would need a disk drive, and Atari DOS 2.5 or compatible. Turn on the computer, type


at the BASIC prompt, then choose N. CREATE MEM.SAV, then choose L. BINARY LOAD, and enter HELLO.

The emulation, also, supports that method. Look at Atari>Settings, and check Enable H: Patch for Hard Disk Devices, then Atari>Hard disks, and set the path of H1: to your executables directory, then use "H0:HELLO.XEX" in the above procedure (after pressing L), to access your harddrive directly.

Note: 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.

6.3 Atmos


Available at

Emulates Oric-1 and Atmos computers, with sound, disk images, scanline-exact NTSC/PAL video, and movie export. Includes monitor. Fortunately for all SDL platforms. You will just need the emulator, all ROMs are supplied.

Compile the tutorial with

cl65 -O -t atmos hello.c text.s -o hello.tap

Start the emulator, choose F1 and Insert tape..., and point to the "hello.tap" executable. The file has an auto start header meant to be loaded directly from tape.

On a real Atmos, you would need a tape drive. Turn on the computer, type


at the BASIC prompt.

The emulation, also, supports that method.

6.4 Commodore


Available at

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.

Compile the tutorial with

cl65 -O -t <sys> hello.c text.s
Substitute the name of a Commodore computer for that <sys>:

Start the desired version of the emulator (CBM510 and CBM610 programs run on the CBM II [xcbm2] emulator).

In the Windows versions of VICE, choose File>Autoboot disk/tape image..., choose your executable, and click OK.

In the Unix versions, hold down the mouse's first button. Move the pointer to Smart-attach disk/tape..., and release the button. Choose your executable, and click Autostart.

The file has a 14-byte header which corresponds to a PRG-format BASIC program, consisting of a single line, similar to this:

1000 sys2061

On a real Commodore with attached disk drive, you would type:


for VIC-20/C64, or:


on PET/CBM II/C128/C16/Plus 4; then, type


On a Commodore 128, you can combine those two commands:


The output will appear on a separate line, and you will be returned to a BASIC prompt.

6.5 GEOS

Available at Click Here Software's GEOS download section:

Graphics Environment Operating System. It provides a WIMP GUI (Windows, Icons, and Mouse-Pointer Graphical User Interface) for Commodore's computer models 64 and 128. It can be controlled by many different types of input devices:

The tutorial files are different for GEOS. You will find them "next door," in "cc65/samples/geos"; they are called "hello1.c" and "apphello1.grc".

Compile the tutorial with

cl65 -O -t geos hello1.c apphello1.grc
Copy the resulting file "hello1" onto a (GEOS-format) disk.

Boot the GEOS master disk/image.

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.

VICE even has different ways that depend on which operating system is running the emulator.

Find the CONVERT program on the boot disk [tap the 6-key; then, you should see it's icon in the fourth position on the deskTop's directory notePad]. Move GEOS's pointer over to CONVERT's icon; double-click it to run that program. Click on the Disk icon; put the disk with "hello1" into the drive; and, click the OK icon. Use the little icons under the list of file-names to move through that list until you find "hello1". Click on it; and then, click on the Convrt icon. CONVERT will ask you to confirm that you choose the correct file; click YES if you did (or, click NO if you made a mistake). After the program has converted "hello1" from a CBM file into a GEOS file, it will announce what it did -- click on OK. CONVERT will show the file list again. This time, click on Quit.

(You might need to put the boot disk back into the drive, in order to reload deskTop. 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].)

Now, you must find hello1. Click on the lower left-hand corner of the directory notePad. Look at the eight file-positions on each page until you see hello1. Double-click on its icon.

The output is shown in a GEOS dialog box; click OK when you have finished reading it.

6.6 Contributions wanted

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.

Finally, emulators which run on Unix or Windows would help to reach a wider audience.

Next Previous Contents