readthis.txt›------------›THE COMPILER AND LINKER REQUIRE 48K. ›REMOVE ALL CARTRIDGES BEFORE USING.›› The ACE C compiler is a newer›version of the DEEP BLUE C compiler›from APX by John Palevich. ACE C,›like DEEP BLUE C, is a subset of›standard C, drawn primarily from Ron›Cain's public domain C-compiler. ›Most programs written using ACE C›can be run on any computer›supporting standard C without›alteration. If you already have›DEEP BLUE C, be sure to read the›file BLUE.TXT before using ACE C. ›Programs written with BLUE C will›not necessarily run on ACE C.›› This text will not teach you›how to program in C. If you are not›familiar with C (and even if you›are), I would advise you to obtain›the book "The C Programming›Language", by Brain W. Kernighan and›Dennis M. Ritchie. It can be tough›reading, but it will define the C›language. If you have questions›about ACE C, you may send them with›a self-addressed, stamped envelope›to:› Ralph E. Walden› 1821 Jefferson› Eugene, Oregon 97402›› All the programs on this disk›use the normalize function in›ACECIO.C when requesting filenames. ›When entering a filename, if you do›not include a drive (Dn:) then it›will be assumed you want D1:. In›all cases, you do not need to›include the extension.› To run the programs on this›disk use the "L" option (load) in›DOS and type in the full filename. ›All programs with the extension›".COM" will run automatically when›they are loaded. If you are using›OS/A DOS, you can run the program by›directly typing its primary name›(the ".COM" will be supplied for›you). The programs may be loaded›from any drive, but the file›"ENGINE.OBJ" MUST be on D1:.› Included on this disk is a›library of standard functions›(ACECIO.CCC), and a library›containing several graphics›functions (GRAPHICS.CCC). For their›descriptions, see the files of the›same name with the extension ".C".››ACE C supports the following:›1) The declarations char, int, and›pointers (also extern). A char›pointer may be used as an unsigned›int for anything except›multiplication and division.›2) Single dimension arrays. (No›pointer arrays - they won't generate›an error, but won't work like›standard C.) Note: floating point›functions are provided, but you must›define a floating point number as:›char name[6];. It will act as a›char array except in floating point›functions. (See FLOAT.TXT.)›3) Unary operators:›+,-,*,&,++,--,!,$- (tilde).›4) Binary operators: +,-,*,/,%,›|,^,&,==,!=,<<,>>,(op)=,&&,||,?:,›(comma),(op)= (example: var += 3›(var=var+3).)›5) Statements: asm, break, case,›continue, default, do, else, for,›if, return, switch, while.›6) #define and #include.›7) Constants: decimal, hexadecimal,›octal, backslash.››Unsupported features of C (these are›NOT in ACE C):›1) Structures, unions.›2) Multidimensional arrays.›3) Full floating point›implementation (See FLOAT.TXT).›4) Functions returning anything but›int.›5) Unary operator: sizeof.›6) Binary operator: type casting.››Differences from standard C:›1) The last clause of a "switch"›statement, either "case" or›"default" must be terminated with a›"break", "continue", or "return".›2) Characters are unsigned, and›range from 0-255.›3) Standard C allows lines to›continue onto the next line. ACE C›is much more particular. ACE C›allows code to begin with line›numbers, therefore, unnumbered lines›MUST begin with a non-number (Space›or character) or it will be deleted. ›Strings and comments may NOT›continue onto the next line.›4) C source code lines can be a›maximum of 199 characters long after›any expansion from #define's.›5) Functions may have a maximum of›126 arguments.›6) When ACE C encounters a /*, it›considers that the end of the line. ›Therefore, comments may not be›imbedded within a line, and they may›not cross over to a new line.›7) ACE C will do constant evaluation›at compile time provided there is›nothing (Space, parenthesis, etc.)›between the numbers and operators: ›num=5*6; will be num=30; at run›time. num=5*(6); will remain the›same. Evaluation is strictly right›to left, and there is no order of›precedence: num=5*6+1; is num=35. ›Use a space or parenthesis to›override constant evaluation.›8) A tab character is not "white›space", i.e. the compiler will try›to compile it. (See CFORMAT.TXT for›converting tabs into spaces.)›9) ACE C has an assembly language›interface. Read the file ASM.TXT›for a description of its use. BLUE›C users: asm on ACE C is VERY›different; be sure to read ASM.TXT!›10) Braces in standard C are›replaced with $( and $). The tilde›is replaced with $-.›11) Variables may not be defined›within a statement.››BACKSLASH: Use of the backslash›within a single or double quote will›generate the following codes:›\b - backspace delete›\d - cursor down›\e - escape›\f - clear screen›\g - bell›\l - cursor left›\m - control M (can be used as a›RETURN on IDS printers)›\n - return›\r - cursor right›\t - tab›\u - cursor up››Additionly, a back space followed by›a number will convert the number to›its actual value. "\65\66" would›generate the string "AB". NOTE: you›cannot put a control comma (graphics›heart) within a string since this is›the end of the string character; you›must use \0.››USING ACE C: Here's a brief summary›of how to get a C program running. ›A more extensive description›follows.›1) Enter the program using the text›editor of your choice and save it to›disk with the extension ".C", with›or without line numbers.›2) Load ACEC and compile the›program.›3) Load LINK and link the program.›4) Load the program (which will›automatically run).››1) EDITING: You may use any text›editor that creates aschii files,›with or without line numbers, to›enter the source program. Note:›CFORMAT.COM will do a lot of the›formatting of a C program for you›(See CFORMAT.TXT). You must save›the file with the extension ".C".››2) COMPILING: The compiler and›linker require 48k so you must›remove any cartridges before running›them. You run the compiler from›Atari DOS using the 'L' option. The›compiler filename is ACEC.COM. From›OS/A+ DOS, just type ACEC, and press›RETURN. The compiler will ask for›the filename, which it will›normalize with the extension ".C". ›The compiler will then create a file›with the extension ".CCC" for use by›the linker. When you press RETURN›after the filename, the screen will›be turned off while the program is›compiled. If any error is›encountered all compilation will›stop, the screen will be turned on,›and the line with an error message›will be displayed. Take note of the›error and press a key, which will›return you to DOS. If compilation›is done without errors, the screen›will be turned back on, and a list›of all the functions in the program›will be displayed. Press RETURN to›go back to DOS, or type in another›filename to compile. Note: the›largest ".CCC" file you can have is›about 9K. It's safer to create›several small files and link them›together then to have one large›file.› Compiler directives in the›source file:› #define - whenever the compiler›encounters the first string (all›characters until the next space) it›will replace it with the second›string (everything to the end of the›line or comment). Example: #define›EOL 155; putchar(EOL); - this will›be changed to putchar(155). Note:›constant evaluation will be done on›the second string.› #include filename - this will›include the filename specified. The›filename will be normalized with the›extension ".H" The included file›is usually used as a header file›containing extern declarations.››3) LINKING: The linker joins›together all files that are to be›part of the same program. You must›first create a file with the›extension ".LNK" which contains a›list of the programs to link›together. The only file types›allowed are ".CCC" and ".OBJ"›(object). All filenames are›normalized with the extension›".CCC", so the extension is needed›only for ".OBJ" files. (Assembly›language files should have the›extension ".OBJ".) The last file›must be either "ENGINE.OBJ" or›"ENGLOAD.OBJ". "ENGLOAD.OBJ" will›result in "ENGINE.OBJ" being loaded›from D1: whenever the program is›run. "ENGINE.OBJ" is about 4000›bytes long, whereas ENGLOAD.OBJ is›only about 130 bytes.›› Load the linker in the same›manner as the compiler (the filename›is LINK.COM). The linker will›request the name of the link file,›which will be normalized with the›extension ".LNK". The linker will›then create a file with the›extension ".COM" which is ready to›run. ACE C is actually a P-code›interpreter and the code to run it,›plus numerous IO functions described›in ACECIO.C, is in the file›ENGINE.OBJ. To access the IO›routines in ENGINE.OBJ you must also›include the file ACECIO in your LNK›file. NOTE: both ACEC.COM and›LINK.COM require ENGINE.OBJ to be on›drive #1, as they use ENGLOAD.OBJ.› If the linker does not find a LNK›file, it will create the following›file:› filename.CCC› ACECIO.CCC› ENGLOAD.OBJ››4) RUNNING: Run your program the›same way you run the linker and›compiler. The extension will always›be ".COM", which need not be›included if you are using OS/A+ DOS. ›When your program is running›correctly, you can use FASTC.COM on›the ".CCC" files which will speed up›your program by 20-30%. (See›FASTC.TXT.)››BE SURE TO READ ALL THE .TXT FILES,›AND LOOK AT THE .C FILES FOR›EXAMPLES.›››