< Index | Lesson 1: Hello World >

Introduction

The purpose of this document is to provide an introduction to the C programming language as it applies to the Amiga personal computer. It may be used by anyone who wishes to learn to program ANSI C or the Amiga API.

The Beginning

So, you've decided that you want to learn how to program in C on the Amiga computer. Congratulations, you have chosen a road filled with knowledge and rewards. Programming is an art form that is based on electrical and mathematical principles and, as such, it is not a trivial pursuit but offers its secrets for a price. C in particular has a very steep learning curve but offers freedoms not offered in easier programming languages. The goal of this document is to offer an introduction to the methods used to program the Amiga computer in the environments of the Amiga’s shell and GUI. There is no doubt that you will become frustrated at some point in your attempt to learn how to program. There is a lot of material to learn and at times it may feel like drinking from the preverbal fire hose, but in those times you must remember that if it were easy, everyone would be a C programmer.

This tutorial is aimed toward Amiga users who are familiar with the fundamental aspects of the AmigaOS and computers in general. It is not meant to be a deep discussion of how computers (and Amiga computers specifically) work. For instance, I will assume that you understand the difference between RAM and ROM and have a general grasp of what a pixel and an escape code are. If you find yourself wondering what a particular term is and you are unable to find a reference, please feel free to e-mail me.

ANSI C

The examples in this document will follow the ANSI C standard. ANSI C is a particular implementation of the C programming language that includes a set of libraries and functions that make portable code much easier to create and maintain. For instance, ANSI C provides functions to output text to a shell, compute standard mathematics functions like sine, or cosine, and manage other mundane tasks that make a programmer's life much easier.

The Compiler

The first course of action of every programmer is to obtain a working compiler. For these examples I will be using a command line compiler because I wish to appeal to a large number of potential programmers who will generally differ about which Integrated Development Environment (IDE) is the best. Command line compilers generally function in a similar fashion on all platforms and therefore, the knowledge gained from using the command line is applicable to any platform and can be extended to any IDE that the programmer encounters.

The compiler of choice for this tutorial is the GCC compiler because it has become the standard on both the classic Amiga systems (AmigaOS 3.9 and below) and is also used in the new AmigaOS 4.0 for the next generation of Amiga computers. Naturally you may use any other C compiler you wish as these tutorials should be quite portable. If you have any questions about your compiler of choice I'd be happy to assist if I am able. I have experience using SAS/C, Manx C, Lattice C, StormC 3 and 4, HiSoft C, VBCC, and GCC on classic Amiga systems. Unfortunately I do not have access to an AmigaOS 4 system, so I may be of limited use to those using these new systems, but you can certainly ask me if you like.

Development Environment

For those who are using a classic Amiga you can find an installer for the GCC here.

For those who are using WinUAE or who wish to download a complete development setup, LouiSe's GCC Environment may be a good place to start. Although LouiSe no longer maintains this environment it is still the quickest and easiest solution to begin programming on the Amiga. If you're new to Amiga programming and don't already have a compiler, I recommend that you download and install LouiSe's development environment. An archive of LouiSe's excellent Amiga developer's web site is available with loads of useful information for any Amiga programmer. The development environment is linked to at the top of the page, just below the banner ad and is available as a hardfile for use with WinUAE or as an archive for installation on a native Amiga. This environment includes a compiler, assembler, editor, and everything else you need to begin programming.

NOTE: If you're using the WinUAE hardfile with LouiSe's development environment, you should make it the primary boot partition and create a second partition for your work since the original hardfile does not contain a great deal of extra space.

Now, on to the code...

< Index | Lession 1: Hello World >

If you find any errors or have any questions or comments please e-mail me.

Last updated on Thursday, November 24, 2005 21:31