Creating ANSI C sources from the A-code source(A-code acdc version 12.85)Contents
A-code sourceLogically, an A-code source is a single file, usually with the .acd suffix. The suffix is optional; if present, it can be omitted when nominating to acdc the A-code file to be processed. In practice, A-code source can be split into a number of files, which are incorporated in the "main" one by means of the A-code include major directive. Again, such include files are conventionally suffixed with .acd, which suffix may be omitted in include statements. A-code frameworkTo build a working executable out of A-code source, you need A-code kernel files, available as a part of the acode system source tarball https://mipmip.org/acode/acode-12.85.html. This tarball contains C sources of the latest releases of the acdc translator and of the A-code kernel, as well as some useful bash scripts. See that page for details. If you are using Linux, Unix or OSX, the simplest thing to do is to use the advbld script supplied as a part of the acode source tarball – please see the README file contained therein. However, if you are using some other platform, you will probably need to build and use acdc yourself. The rest of this document explains how to do that. Building and using the acdc translatorTo build the acdc executable you need only an ANSI C compiler. Simply compile and link the relevant C sources – no libraries or special compilation or linking options required.
The acdc translator takes the following command line arguments (in any order):
By default, the game's text data is preloaded into the executable. These days only very old and/or small machines are unhappy with the size of the resulting executable. However, if the default behaviour is for any reason not the suitable one, there are three further deprecated command line options that can be used.
Derived ANSI C sources are created in the directory from which acdc is run, except that if a sub-directory called C is found in the directory in which the A-code source is located, the derived sources are placed there. Adding kernel source filesThe A-code kernel consists of source files adv00.c, adv01.h and adv0.h. All three can be found in the A-code source tarball. Copy them alongside the C sources created by acdc, and you will have the complete C source required to build an executable. Building an executableBuilding a simple adventure executable from the derived C sources is simplicity itself: just compile and link the lot together with any ANSI C compiler. The resulting executable will default to using a local browser for its display (except for DOS builds). But it will lack command history and editing in the console mode. If that's good enough for you, fine, but if you hit problems, or want a more sophisticated version, read the guide to building A-code games from intermediate C sources. |