A-code games from intermediate C sources

(A-code version 12.29)

Contents


Derived C sources

A-code games are, naturally enough, written in A-code, but as the first step of building an executable out of the A-code source, the A-code-to-C translator acdc creates self-contained, intermediate ANSI C source, which can be compiled and linked as any C program would be. This allows A-code games to be distributed in a highly portable C-source format.

I assume that you already have an A-code game C source, either from one of the A-code games on the adventure downloads page, or as the result of translating some A-code source by running acdc. If so, all you need now is an ANSI C compiler. In the below I assume gcc being used, but any ANSI-compliant compiler should do.

If your system has the unistd library installed, you should add -DHAVE_UNISTD_H to all compilation commands given below.


Building an executable from the C sources

A C sources bundle should already have all the sources you need, but if you are using the acdc translator, you will need to add to the C source files created by the translator, the kernel C source files, which are supplied as a part of the A-code bundle. (At present these kernel source files are adv00.c, adv01.c and adv0.h).


Text data handling

By default, since version 12.01 of A-code, all text data is preloaded into the game executable. This is a change from previous versions, which hived off text data into a separate .dat file. This is the simplest and most sensible arrangement for most machines these days, but a few years ago I still saw some not entirely obsolete machines balking at the size of adv770 executable with preloaded data. Hence other options are also on offer, even if you don't have access to game A-code sources..


Summary of kernel compilation symbols

HAVE_UNISTD_H
Causes the unistd.h header file to be included. This may be necessary to eliminate some warning on systems with the unistd library.

MEMORY
Causes text data file to be read entirely into memory on game startup.

FILE
Causes text data file to be read from whenever text data is require.

SWAP or SWAP=<n>
Causes text data file to be buffered by the A-code internal paging mechanism of <n> 1KB buffers (default 32 buffers) on the first-in-first-out basis.

READLINE

Causes command recall and editing to be enabled in the console display mode. Requires readline and ncurses libraries to be linked in.

CONSOLE
Causes the game to be built with no browser support, i.e. for console display mode only.

NO_SLOW
Causes the game to be built without support for baud rate setting in the console mode.

GLK
Causes the game to use the Glk windowing interface, with no console or browser mode. Deprecated (and no longer guaranteed to work) on platforms other than MS Windows.

Any other symbols used by the kernel sources are either for internal use only, or are to do with my on-going work on A-code.


Back to A-code page
Back to main page
Mike Arnautov, Sunday, 02-May-2010 05:42:31 MDT