Hello cc65!

Here we go again - the mighty piece of code that never dies…

#include <stdio.h>

void main(void)
{
	printf("Hello, world!\n");
}

You save the above programming masterpiece using your favourite text editor as hello.c and the fun begins… You probably should read the excellent cc65 documentation or at least the introduction section before continuing. This will make things more clear and structured in your mind :-) For now, we assume that you know what are the translation phases (or you just don't want to know that) and we go the easy way, using cc65's Compile & Link utility. The beauty of this utility is that single command:

$ cl65 hello.c

should create for you one object file named “hello.o” and one (C64) executable named “hello”:

$ ls -l
total 24
-rw-r--r--  1 user  staff  2758 17 cze 20:05 hello
-rw-r--r--  1 user  staff    68 17 cze 19:38 hello.c
-rw-r--r--  1 user  staff   568 17 cze 20:05 hello.o
$

C64 is the default target for many cc65 tools. If you need to have your pride compiled for a different target platform you need to add a switch to the command line:

$ cl65 -t apple2 hello.c

creates executable file for Apple ][ machines. For a complete list of supported target platforms, please refer to the cc65 documentation and ld65 linker options for setting the target.

cc65/hello_world.txt · Last modified: 2013-03-17 17:36 by silverdr
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution 3.0 Unported
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki